HTML_FlexyFramework::get()->Core_Mailer['debug'] = true;
}
- $sent = (empty($w->sent) || preg_match('/^1000/', $w->sent)) ? false : true;
+ $sent = (empty($w->sent) || preg_match('/^(0|1)000/', $w->sent)) ? false : true;
if (!$force && (!empty($w->msgid) || $sent)) {
$ww = clone($w);
if (!$sent) { // fix sent.
- $w->sent = $w->sent == '0000-00-00 00:00:00' ? $w->sqlValue('NOW()') :$w->sent; // do not update if sent.....
+ $w->sent = preg_match('/^(0|1)000/', $w->sent) ? $w->sqlValue('NOW()') :$w->sent; // do not update if sent.....
$w->update($ww);
}
$this->errorHandler("message has been sent already.\n");
$cev = DB_DataObject::Factory('Events');
$cev->on_table = $this->table;
$cev->on_id = $w->id;
- $cev->action = 'NOTIFYSENT';
+ $cev->whereAdd("action IN ('NOTIFYSENT', 'NOTIFYFAIL')");
$cev->limit(1);
if ($cev->count()) {
$cev->find(true);
- $w->flagDone($cev, 'alreadysent');
- $this->errorHandler( "SENT (fix old) ". $cev->remarks);
+ $w->flagDone($cev, $cev->action == 'NOTIFYSENT' ? 'alreadysent' : '');
+ $this->errorHandler( $cev->action . " (fix old) ". $cev->remarks);
}