//$context = CRM_Utils_Type::escape(CRM_Utils_Array::value('context', $_GET), 'String');
$sortMapper = array(
- 0 => 'subject', 1 => 'mailing_creator', 2 => 'start_date', 3 => 'links',
+ 0 => 'subject', 1 => 'creator_name', 2 => 'start_date', 3 => 'links',
);
$sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
return $fnName(
$params['contact_id'],
$params['offset'],
- $params['limit']
+ $params['limit'],
+ CRM_Utils_Array::value('sort', $params)
);
}
$limit,
$selectFields,
$fromClause,
- $whereClause
+ $whereClause,
+ $sort
) {
$defaultFields = array(
'm.id' => 'mailing_id',
}
$select = implode(', ', $select);
+ $orderBy = 'ORDER BY j.start_date';
+ if ($sort) {
+ $orderBy = "ORDER BY $sort";
+ }
+
$sql = "
SELECT $select
FROM civicrm_mailing m
AND meq.contact_id = %1
$whereClause
GROUP BY m.id
-ORDER BY j.start_date
+{$orderBy}
";
if ($limit > 0) {
function _civicrm_api3_mailing_contact_get_delivered(
$contactID,
$offset,
- $limit
+ $limit,
+ $sort
) {
$selectFields = array('med.time_stamp' => 'start_date');
$limit,
$selectFields,
$fromClause,
- $whereClause
+ $whereClause,
+ $sort
);
}
function _civicrm_api3_mailing_contact_get_bounced(
$contactID,
$offset,
- $limit
+ $limit,
+ $sort
) {
$fromClause = "
INNER JOIN civicrm_mailing_event_bounce meb ON meb.event_queue_id = meq.id
$limit,
NULL,
$fromClause,
- NULL
+ NULL,
+ $sort
);
}