本文整理汇总了PHP中CRM_Mailing_Event_BAO_Bounce::copyValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Mailing_Event_BAO_Bounce::copyValues方法的具体用法?PHP CRM_Mailing_Event_BAO_Bounce::copyValues怎么用?PHP CRM_Mailing_Event_BAO_Bounce::copyValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Mailing_Event_BAO_Bounce
的用法示例。
在下文中一共展示了CRM_Mailing_Event_BAO_Bounce::copyValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
/**
* Create a new bounce event, update the email address if necessary
*/
static function &create(&$params)
{
$q =& CRM_Mailing_Event_BAO_Queue::verify($params['job_id'], $params['event_queue_id'], $params['hash']);
$success = NULL;
if (!$q) {
return $success;
}
$transaction = new CRM_Core_Transaction();
$bounce = new CRM_Mailing_Event_BAO_Bounce();
$bounce->time_stamp = date('YmdHis');
// if we dont have a valid bounce type, we should set it
// to bounce_type_id 11 which is Syntax error. this allows such email
// addresses to be bounce a few more time before being put on hold
// CRM-4814
// we changed this behavior since this bounce type might be due to some issue
// with the connection or smtp server etc
if (empty($params['bounce_type_id'])) {
$params['bounce_type_id'] = 11;
if (empty($params['bounce_reason'])) {
$params['bounce_reason'] = ts('Unknown bounce type: Could not parse bounce email');
}
}
// CRM-11989
$params['bounce_reason'] = substr($params['bounce_reason'], 0, 254);
$bounce->copyValues($params);
$bounce->save();
$success = TRUE;
$bounceTable = CRM_Mailing_Event_BAO_Bounce::getTableName();
$bounceType = CRM_Mailing_DAO_BounceType::getTableName();
$emailTable = CRM_Core_BAO_Email::getTableName();
$queueTable = CRM_Mailing_Event_BAO_Queue::getTableName();
$bounce->reset();
// might want to put distinct inside the count
$query = "SELECT count({$bounceTable}.id) as bounces,\n {$bounceType}.hold_threshold as threshold\n FROM {$bounceTable}\n INNER JOIN {$bounceType}\n ON {$bounceTable}.bounce_type_id = {$bounceType}.id\n INNER JOIN {$queueTable}\n ON {$bounceTable}.event_queue_id = {$queueTable}.id\n INNER JOIN {$emailTable}\n ON {$queueTable}.email_id = {$emailTable}.id\n WHERE {$emailTable}.id = {$q->email_id}\n AND ({$emailTable}.reset_date IS NULL\n OR {$bounceTable}.time_stamp >= {$emailTable}.reset_date)\n GROUP BY {$bounceTable}.bounce_type_id\n ORDER BY threshold, bounces desc";
$bounce->query($query);
while ($bounce->fetch()) {
if ($bounce->bounces >= $bounce->threshold) {
$email = new CRM_Core_BAO_Email();
$email->id = $q->email_id;
$email->on_hold = TRUE;
$email->hold_date = date('YmdHis');
$email->save();
break;
}
}
$transaction->commit();
return $success;
}
示例2: date
/**
* Create a new bounce event, update the email address if necessary
*/
static function &create(&$params)
{
$q =& CRM_Mailing_Event_BAO_Queue::verify($params['job_id'], $params['event_queue_id'], $params['hash']);
$success = null;
if (!$q) {
return $success;
}
require_once 'CRM/Core/Transaction.php';
$transaction = new CRM_Core_Transaction();
$bounce = new CRM_Mailing_Event_BAO_Bounce();
$bounce->time_stamp = date('YmdHis');
// if we dont have a valid bounce type, we should set it
// to bounce_type_id 6 which is Invalid. this allows such email
// addresses to be put on hold immediately, CRM-4814
if (empty($params['bounce_type_id'])) {
$params['bounce_type_id'] = 6;
$params['bounce_reason'] = ts('Unknown bounce type: Could not parse bounce email');
}
$bounce->copyValues($params);
$bounce->save();
$success = true;
$bounceTable = CRM_Mailing_Event_BAO_Bounce::getTableName();
$bounceType = CRM_Mailing_DAO_BounceType::getTableName();
$emailTable = CRM_Core_BAO_Email::getTableName();
$queueTable = CRM_Mailing_Event_BAO_Queue::getTableName();
$bounce->reset();
// might want to put distinct inside the count
$query = "SELECT count({$bounceTable}.id) as bounces,\n {$bounceType}.hold_threshold as threshold\n FROM {$bounceTable}\n INNER JOIN {$bounceType}\n ON {$bounceTable}.bounce_type_id = {$bounceType}.id\n INNER JOIN {$queueTable}\n ON {$bounceTable}.event_queue_id = {$queueTable}.id\n INNER JOIN {$emailTable}\n ON {$queueTable}.email_id = {$emailTable}.id\n WHERE {$emailTable}.id = {$q->email_id}\n AND ({$emailTable}.reset_date IS NULL\n OR {$bounceTable}.time_stamp >= {$emailTable}.reset_date)\n GROUP BY {$bounceTable}.bounce_type_id\n ORDER BY threshold, bounces desc";
$bounce->query($query);
while ($bounce->fetch()) {
if ($bounce->bounces >= $bounce->threshold) {
$email = new CRM_Core_BAO_Email();
$email->id = $q->email_id;
$email->on_hold = true;
$email->hold_date = date('YmdHis');
$email->save();
break;
}
}
$transaction->commit();
return $success;
}