$aclWhere = $aclWhere ? "WHERE {$aclWhere}" : '';
$limitString = NULL;
if ($limit && $offset !== NULL) {
+ $offset = CRM_Utils_Type::escape($offset, 'Int');
+ $limit = CRM_Utils_Type::escape($limit, 'Int');
+
$limitString = "LIMIT $offset, $limit";
}
private function _getMailingGroupIds($type = 'Include') {
$mailingGroup = new CRM_Mailing_DAO_MailingGroup();
$group = CRM_Contact_DAO_Group::getTableName();
- if (!isset($thi->sid)) {
+ if (!isset($this->id)) {
// we're just testing tokens, so return any group
$query = "SELECT id AS entity_id
FROM $group
) as $key) {
$url = 'mailing/detail';
$reportFilter = "reset=1&mailing_id_value={$mailing_id}";
- $searchFilter = "force=1&mailing_id={$mailing_id}";
+ $searchFilter = "force=1&mailing_id=%%mid%%";
switch ($key) {
case 'delivered':
$reportFilter .= "&delivery_status_value=successful";
if (array_key_exists(CRM_Core_Action::ADVANCED, $actionLinks)) {
$actionLinks[CRM_Core_Action::ADVANCED]['qs'] = $searchFilter;
}
- $report['event_totals']['actionlinks'][$key] = CRM_Core_Action::formLink($actionLinks, $action, array());
+ $report['event_totals']['actionlinks'][$key] = CRM_Core_Action::formLink(
+ $actionLinks,
+ $action,
+ array('mid' => $mailing_id),
+ ts('more'),
+ FALSE,
+ 'mailing.report.action',
+ 'Mailing',
+ $mailing_id
+ );
}
return $report;
$groups = CRM_Core_PseudoConstant::group(NULL, FALSE);
if (!empty($groups)) {
$groupIDs = implode(',', array_keys($groups));
- $selectClause = ($count) ? 'COUNT( DISTINCT m.id) as count' : 'DISTINCT( m.id ) as id';
// get all the mailings that are in this subset of groups
$query = "
-SELECT $selectClause
+SELECT DISTINCT( m.id ) as id
FROM civicrm_mailing m
LEFT JOIN civicrm_mailing_group g ON g.mailing_id = m.id
WHERE ( ( g.entity_table like 'civicrm_group%' AND g.entity_id IN ( $groupIDs ) )
}
if ($rowCount) {
+ $offset = CRM_Utils_Type::escape($offset, 'Int');
+ $rowCount = CRM_Utils_Type::escape($rowCount, 'Int');
+
$query .= " LIMIT $offset, $rowCount ";
}
CRM_Core_Error::fatal();
}
+ CRM_Utils_Hook::pre('delete', 'Mailing', $id, CRM_Core_DAO::$_nullArray);
+
// delete all file attachments
CRM_Core_BAO_File::deleteEntityFile('civicrm_mailing',
$id
$dao->delete();
CRM_Core_Session::setStatus(ts('Selected mailing has been deleted.'), ts('Deleted'), 'success');
+
+ CRM_Utils_Hook::post('delete', 'Mailing', $id, $dao);
}
/**
);
- $form->_templates = CRM_Core_BAO_MessageTemplates::getMessageTemplates(FALSE);
+ $form->_templates = CRM_Core_BAO_MessageTemplate::getMessageTemplates(FALSE);
if (!empty($form->_templates)) {
$form->assign('templates', TRUE);
$form->add('select', 'template', ts('Use Template'),
)
);
- $form->_templates = CRM_Core_BAO_MessageTemplates::getMessageTemplates(FALSE);
+ $form->_templates = CRM_Core_BAO_MessageTemplate::getMessageTemplates(FALSE);
if (!empty($form->_templates)) {
$form->assign('templates', TRUE);
$form->add('select', 'template', ts('Select Template'),
// CRM_Core_Error::debug_log_message("Beginning processQueue run: {$config->mailerJobsMax}, {$config->mailerJobSize}");
if ($mode == NULL && CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG") {
- CRM_Core_Error::fatal(ts('The <a href="%1">default mailbox</a> has not been configured. You will find <a href="%2">more info in the online user and administrator guide</a>', array(1 => CRM_Utils_System::url('civicrm/admin/mailSettings', 'reset=1'), 2 => "http://book.civicrm.org/user/initial-set-up/email-system-configuration")));
+ CRM_Core_Error::fatal(ts('The <a href="%1">default mailbox</a> has not been configured. You will find <a href="%2">more info in the online user and administrator guide</a>', array(1 => CRM_Utils_System::url('civicrm/admin/mailSettings', 'reset=1'), 2 => "http://book.civicrm.org/user/advanced-configuration/email-system-configuration/")));
}
// check if we are enforcing number of parallel cron jobs
return TRUE;
}
- private function addMultipleEmails($mailingID) {
+ private static function addMultipleEmails($mailingID) {
$sql = "
INSERT INTO civicrm_mailing_recipients
(mailing_id, email_id, contact_id)
CRM_Core_Action::VIEW => array(
'name' => ts('View'),
'url' => 'civicrm/mailing/view',
- 'qs' => "reset=1&id={$values['mailing_id']}",
+ 'qs' => "reset=1&id=%%mid%%",
'title' => ts('View Mailing'),
'class' => 'crm-mailing-view',
),
CRM_Core_Action::BROWSE => array(
'name' => ts('Mailing Report'),
'url' => 'civicrm/mailing/report',
- 'qs' => "mid={$values['mailing_id']}&reset=1&cid={$params['contact_id']}&context=mailing",
+ 'qs' => "mid=%%mid%%&reset=1&cid=%%cid%%&context=mailing",
'title' => ts('View Mailing Report'),
)
);
- $contactMailings[$mailingId]['links'] = CRM_Core_Action::formLink($actionLinks);
+ $contactMailings[$mailingId]['links'] = CRM_Core_Action::formLink(
+ $actionLinks,
+ null,
+ array(
+ 'mid' => $values['mailing_id'],
+ 'cid' => $params['contact_id'],
+ ),
+ ts('more'),
+ FALSE,
+ 'mailing.contact.action',
+ 'Mailing',
+ $values['mailing_id']
+ );
}
return $contactMailings;