From d4d28ddcb123331f8688a43f27401bcb8ae6af8f Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 21 May 2015 23:05:27 -0700 Subject: [PATCH] Fix: Emails could be blank under some circumstances. --- e107_admin/mailout.php | 18 ++++++++++++++---- e107_handlers/e107_class.php | 1 + e107_handlers/mail_manager_class.php | 5 +++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/e107_admin/mailout.php b/e107_admin/mailout.php index 871fb457a..6c2d15faf 100644 --- a/e107_admin/mailout.php +++ b/e107_admin/mailout.php @@ -1576,8 +1576,8 @@ class mailout_recipients_ui extends e_admin_ui protected $fields = array( 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), 'mail_target_id' => array('title' => LAN_MAILOUT_143, 'thclass' => 'left', 'forced' => TRUE), - 'mail_recipient_id' => array('title' => LAN_MAILOUT_142, 'type'=>'number', 'data'=>'int', 'thclass' => 'left'), - 'mail_recipient_name' => array('title' => LAN_MAILOUT_141, 'forced' => TRUE), + 'mail_recipient_id' => array('title' => LAN_MAILOUT_142, 'type'=>'number', 'data'=>'int', 'thclass' => 'left', 'readonly'=>2), + 'mail_recipient_name' => array('title' => LAN_MAILOUT_141, 'type'=>'text', 'readonly'=>2, 'forced' => TRUE), 'mail_recipient_email' => array('title' => LAN_MAILOUT_140, 'thclass' => 'left', 'forced' => TRUE), 'mail_status' => array('title' => LAN_MAILOUT_138, 'type'=>'method', 'filter'=>true, 'data'=>'int', 'thclass' => 'left', 'class'=>'left', 'writeParms'=>''), 'mail_detail_id' => array('title' => LAN_MAILOUT_137, 'type'=>'dropdown', 'filter'=>true), @@ -1683,7 +1683,7 @@ class mailout_recipients_form_ui extends e_admin_form_ui if($mode == 'write') { - return $curVal; + return $this->select('mail_status', $this->mailStatus, $curVal); } if($mode == 'filter') @@ -1702,7 +1702,17 @@ class mailout_recipients_form_ui extends e_admin_form_ui $preview = e_SELF."?mode=main&action=preview&id=".$eid.'&user='.$user; $text = "".E_32_SEARCH.""; - $att['readParms']['editClass'] = e_UC_NOBODY; + + + if(E107_DEBUG_LEVEL > 0) + { + $att['readParms']['editClass'] = e_UC_MAINADMIN; + } + else + { + $att['readParms']['editClass'] = e_UC_NOBODY; + } + $text .= $this->renderValue('options',$value,$att,$id); return $text; diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index d6b3f2e50..a70bcb1d6 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -212,6 +212,7 @@ class e107 'userlogin' => '{e_HANDLER}login.php', 'validatorClass' => '{e_HANDLER}validator_class.php', 'xmlClass' => '{e_HANDLER}xml_class.php', + 'e107MailManager' => '{e_HANDLER}mail_manager_class.php' ); /** diff --git a/e107_handlers/mail_manager_class.php b/e107_handlers/mail_manager_class.php index 17fb07315..a71446f9f 100644 --- a/e107_handlers/mail_manager_class.php +++ b/e107_handlers/mail_manager_class.php @@ -601,7 +601,7 @@ class e107MailManager AND mt.`mail_status` <= ".MAIL_STATUS_MAX_ACTIVE." AND mt.`mail_send_date` <= ".time()." AND (ms.`mail_last_date` >= ".time()." OR ms.`mail_last_date`=0) - ORDER BY ms.`mail_e107_priority` DESC {$count}"; + ORDER BY ms.`mail_e107_priority` DESC, mt.mail_target_id ASC {$count}"; // echo $query.'
'; $result = $this->db->gen($query); @@ -704,7 +704,7 @@ class e107MailManager if (!$this->currentMailBody) { - if (isset($email['mail_body_templated'])) + if (!empty($email['mail_body_templated'])) { $this->currentMailBody = $email['mail_body_templated']; } @@ -712,6 +712,7 @@ class e107MailManager { $this->currentMailBody = $email['mail_body']; } + $this->currentTextBody = $email['mail_body_alt']; // May be null }