class CRM_Mailing_Event_BAO_Delivered extends CRM_Mailing_Event_DAO_Delivered {
/**
- * class constructor
+ * Class constructor
*/
function __construct() {
parent::__construct();
* @access public
* @static
*/
- public static function getTotalCount($mailing_id, $job_id = NULL, $is_distinct = FALSE) {
+ public static function getTotalCount($mailing_id, $job_id = NULL, $is_distinct = FALSE, $toDate = NULL) {
$dao = new CRM_Core_DAO();
$delivered = self::getTableName();
WHERE $bounce.id IS null
AND $mailing.id = " . CRM_Utils_Type::escape($mailing_id, 'Integer');
+ if (!empty($toDate)) {
+ $query .= " AND $delivered.time_stamp <= $toDate";
+ }
+
if (!empty($job_id)) {
$query .= " AND $job.id = " . CRM_Utils_Type::escape($job_id, 'Integer');
}
* @static
*/
public static function &getRows($mailing_id, $job_id = NULL,
- $is_distinct = FALSE, $offset = NULL, $rowCount = NULL, $sort = NULL, $is_test = FALSE
+ $is_distinct = FALSE, $offset = NULL, $rowCount = NULL, $sort = NULL, $is_test = 0
) {
$dao = new CRM_Core_Dao();
$email = CRM_Core_BAO_Email::getTableName();
$query = "
- SELECT $contact.display_name as display_name,
+ SELECT $delivered.id as id,
+ $contact.display_name as display_name,
$contact.id as contact_id,
$email.email as email,
$delivered.time_stamp as date
$url = CRM_Utils_System::url('civicrm/contact/view',
"reset=1&cid={$dao->contact_id}"
);
- $results[] = array(
+ $results[$dao->id] = array(
+ 'contact_id' => $dao->contact_id,
'name' => "<a href=\"$url\">{$dao->display_name}</a>",
'email' => $dao->email,
'date' => CRM_Utils_Date::customFormat($dao->date),
}
}
-