mirror of
https://github.com/e107inc/e107.git
synced 2025-07-30 11:20:25 +02:00
Bulk mailing fixes.
This commit is contained in:
@@ -1645,7 +1645,7 @@ class mailout_recipients_ui extends e_admin_ui
|
||||
'mail_recipient_email' => array('title' => LAN_MAILOUT_140, 'type'=>'email', 'data'=>'str', '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),
|
||||
'mail_send_date' => array('title' => LAN_MAILOUT_139, 'proc' => 'sdatetime'),
|
||||
'mail_send_date' => array('title' => LAN_MAILOUT_139, 'type'=>'datestamp', 'proc' => 'sdatetime'),
|
||||
'mail_target_info' => array('title' => LAN_MAILOUT_148, 'proc' => 'array'),
|
||||
'options' => array('title' => LAN_OPTIONS, 'type'=>'method', 'width'=>'10%', 'forced' => TRUE)
|
||||
);
|
||||
@@ -1726,6 +1726,7 @@ class mailout_recipients_form_ui extends e_admin_form_ui
|
||||
MAIL_STATUS_PENDING => LAN_MAILOUT_214,
|
||||
// MAIL_STATUS_SAVED => LAN_MAILOUT_215,
|
||||
// MAIL_STATUS_HELD => LAN_MAILOUT_217
|
||||
// MAIL_STATUS_TEMP => ",
|
||||
);
|
||||
|
||||
|
||||
@@ -1742,7 +1743,7 @@ class mailout_recipients_form_ui extends e_admin_form_ui
|
||||
$stat[13] = 'label-warning';
|
||||
$stat[5] = 'label-error'; // MAIL_STATUS_FAILED
|
||||
|
||||
return "<span class='label ".varset($stat[$curVal])."'>".$this->getController()->mailManager->statusToText($curVal)."</span>";
|
||||
return "<span class='label ".varset($stat[$curVal])."'>#".$curVal." ".$this->getController()->mailManager->statusToText($curVal)."</span>";
|
||||
}
|
||||
|
||||
if($mode == 'write')
|
||||
|
@@ -216,7 +216,7 @@ class e107MailManager
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($overrides = false)
|
||||
public function __construct($overrides = array())
|
||||
{
|
||||
$this->e107 = e107::getInstance();
|
||||
|
||||
@@ -224,10 +224,10 @@ class e107MailManager
|
||||
|
||||
$bulkmailer = (!empty($pref['bulkmailer'])) ? $pref['bulkmailer'] : $pref['mailer'];
|
||||
|
||||
if($overrides === false)
|
||||
{
|
||||
$overrides = array('mailer'=>$bulkmailer);
|
||||
}
|
||||
// if($overrides === false)
|
||||
// {
|
||||
$overrides['mailer'] = $bulkmailer;
|
||||
// }
|
||||
|
||||
$this->mailOverrides = $overrides;
|
||||
|
||||
@@ -1188,13 +1188,25 @@ class e107MailManager
|
||||
*/
|
||||
public function mailAddNoDup($handle, $mailRecip, $initStatus = MAIL_STATUS_TEMP, $priority = self::E107_EMAIL_PRIORITY_LOW)
|
||||
{
|
||||
|
||||
if (($handle <= 0) || !is_numeric($handle)) return FALSE;
|
||||
if (!isset($this->mailCounters[$handle])) return 'nocounter';
|
||||
|
||||
$this->checkDB(1); // Make sure DB object created
|
||||
$result = $this->db->db_Select('mail_recipients', 'mail_target_id', "`mail_detail_id`={$handle} AND `mail_recipient_email`='{$mailRecip['mail_recipient_email']}'");
|
||||
if ($result === FALSE)
|
||||
|
||||
if(empty($mailRecip['mail_recipient_email']))
|
||||
{
|
||||
return FALSE;
|
||||
e107::getMessage()->addError("Empty Recipient Email");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$result = $this->db->select('mail_recipients', 'mail_target_id', "`mail_detail_id`={$handle} AND `mail_recipient_email`='{$mailRecip['mail_recipient_email']}'");
|
||||
|
||||
|
||||
if ($result === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
elseif ($result != 0)
|
||||
{
|
||||
@@ -1204,8 +1216,10 @@ class e107MailManager
|
||||
$mailRecip['mail_status'] = $initStatus;
|
||||
$mailRecip['mail_detail_id'] = $handle;
|
||||
$mailRecip['mail_send_date'] = time();
|
||||
$data = $this->targetToDb($mailRecip); // Convert internal types
|
||||
if ($this->db->db_Insert('mail_recipients', array('data' => $data, '_FIELD_TYPES' => $this->dbTypes['mail_recipients'])))
|
||||
|
||||
$data = $this->targetToDb($mailRecip);
|
||||
// Convert internal types
|
||||
if ($this->db->insert('mail_recipients', array('data' => $data, '_FIELD_TYPES' => $this->dbTypes['mail_recipients'])))
|
||||
{
|
||||
$this->mailCounters[$handle]['add']++;
|
||||
}
|
||||
|
@@ -582,6 +582,7 @@ class mailoutAdminClass extends e107MailManager
|
||||
// Definitely need this plugin
|
||||
$mailClass = $mailer . '_mailout';
|
||||
$temp = new $mailClass;
|
||||
// $temp = e107::getSingleton($mailClass);
|
||||
if($temp->mailerEnabled)
|
||||
{
|
||||
$this->mailHandlers[$mailer] = $temp;
|
||||
@@ -966,7 +967,7 @@ class mailoutAdminClass extends e107MailManager
|
||||
$tList = self::getEmailTemplateNames('user');
|
||||
foreach($tList as $key => $val)
|
||||
{
|
||||
$emFormat[$key] = LAN_TEMPLATE . $val;
|
||||
$emFormat[$key] = LAN_TEMPLATE .": ". $val;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1517,7 +1518,8 @@ class mailoutAdminClass extends e107MailManager
|
||||
{
|
||||
|
||||
$mailerCount = $m->selectInit($mailData['mail_selectors'][$key]); // Initialise
|
||||
if($mailerCount > 0)
|
||||
|
||||
if(!empty($mailerCount))
|
||||
{
|
||||
|
||||
while($row = $m->selectAdd()) // Get email addresses - add to list, strip duplicates
|
||||
@@ -1531,6 +1533,13 @@ class mailoutAdminClass extends e107MailManager
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
e107::getMessage()->addWarning($key.": no matching recipients");
|
||||
}
|
||||
|
||||
|
||||
|
||||
$m->select_close();
|
||||
// Close
|
||||
// Update the stats after each handler
|
||||
@@ -1582,7 +1591,10 @@ class mailoutAdminClass extends e107MailManager
|
||||
$text .= '</td></tr>';
|
||||
|
||||
// Figures - number of emails to send, number of duplicates stripped
|
||||
$text .= '<tr><td>' . LAN_MAILOUT_173 . '</td><td>' . ($mailData['mail_togo_count']) . "<input type='hidden' name='mailIDConf' value='{$mailMainID}' /></td></tr>";
|
||||
|
||||
$totalRecipients = !empty($mailData['mail_togo_count']) ? $mailData['mail_togo_count'] : $counters['add'];
|
||||
|
||||
$text .= '<tr><td>' . LAN_MAILOUT_173 . '</td><td>' . $totalRecipients . "<input type='hidden' name='mailIDConf' value='{$mailMainID}' /></td></tr>";
|
||||
$text .= '<tr><td>' . LAN_MAILOUT_71 . '</td><td> ' . $counters['add'] . ' ' . LAN_MAILOUT_69 . $counters['dups'] . LAN_MAILOUT_70 . '</td></tr>';
|
||||
$text .= "</tbody></table>\n</fieldset>";
|
||||
|
||||
|
Reference in New Issue
Block a user