$details = $details[0][0] ?? NULL;
}
else {
- $details = CRM_Utils_Token::getTokenDetails($mailingParams, $returnProperties, TRUE, TRUE, NULL, $mailing->getFlattenedTokens());
- $details = $details[0][$contactID];
+ [$details] = CRM_Utils_Token::getTokenDetails($mailingParams, $returnProperties, TRUE, TRUE, NULL, $mailing->getFlattenedTokens());
+ $details = $details[$contactID];
}
$mime = $mailing->compose(NULL, NULL, NULL, $contactID, $fromEmail, $fromEmail,
return civicrm_api3_create_success($stats);
}
+function _civicrm_api3_mailing_update_email_resetdate_spec(&$spec) {
+ $spec['minDays']['title'] = 'Number of days to wait without a bounce to assume successful delivery (default 3)';
+ $spec['minDays']['type'] = CRM_Utils_Type::T_INT;
+ $spec['minDays']['api.default'] = 3;
+ $spec['minDays']['api.required'] = 1;
+
+ $spec['maxDays']['title'] = 'Analyze mailings since this many days ago (default 7)';
+ $spec['maxDays']['type'] = CRM_Utils_Type::T_INT;
+ $spec['maxDays']['api.default'] = 7;
+ $spec['maxDays']['api.required'] = 1;
+}
+
/**
* Fix the reset dates on the email record based on when a mail was last delivered.
*
* @return array
*/
function civicrm_api3_mailing_update_email_resetdate($params) {
- CRM_Mailing_Event_BAO_Delivered::updateEmailResetDate(
- CRM_Utils_Array::value('minDays', $params, 3),
- CRM_Utils_Array::value('maxDays', $params, 3)
- );
+ CRM_Mailing_Event_BAO_Delivered::updateEmailResetDate((int) $params['minDays'], (int) $params['maxDays']);
return civicrm_api3_create_success();
}