From 47546fcfd2f1111e77b0c048060d9d67322c61e8 Mon Sep 17 00:00:00 2001 From: Pratik Joshi Date: Fri, 23 Aug 2013 21:11:02 +0530 Subject: [PATCH] CRM-13026 : minor fixes and improvements --- CRM/Mailing/BAO/Query.php | 8 +++++++- CRM/Mailing/Form/Task.php | 15 +++------------ CRM/Mailing/Selector/Search.php | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/CRM/Mailing/BAO/Query.php b/CRM/Mailing/BAO/Query.php index 793aa6a419..9495096e8b 100644 --- a/CRM/Mailing/BAO/Query.php +++ b/CRM/Mailing/BAO/Query.php @@ -111,6 +111,11 @@ class CRM_Mailing_BAO_Query { $query->_select['mailing_job_end_date'] = "civicrm_mailing_job.end_date as mailing_job_end_date"; $query->_element['mailing_job_end_date'] = 1; } + + if (CRM_Utils_Array::value('mailing_event_queue_id', $query->_returnProperties)) { + $query->_select['mailing_event_queue_id'] = " civicrm_mailing_event_queue.id as mailing_event_queue_id"; + $query->_element['mailing_event_queue_id'] = 1; + } } } @@ -179,7 +184,8 @@ class CRM_Mailing_BAO_Query { 'mailing_job_status' => 1, 'mailing_job_end_date' => 1, 'contact_type' => 1, - 'contact_sub_type' => 1 + 'contact_sub_type' => 1, + 'mailing_event_queue_id' => 1 ); } return $properties; diff --git a/CRM/Mailing/Form/Task.php b/CRM/Mailing/Form/Task.php index 7076b296c7..2c726498bb 100644 --- a/CRM/Mailing/Form/Task.php +++ b/CRM/Mailing/Form/Task.php @@ -60,13 +60,6 @@ class CRM_Mailing_Form_Task extends CRM_Core_Form { */ protected $_componentIds; - /** - * The array that holds all the contact ids - * - * @var array - */ - public $_contactIds; - /** * build all the data structures needed to build the form * @@ -80,14 +73,13 @@ class CRM_Mailing_Form_Task extends CRM_Core_Form { } static function preProcessCommon(&$form, $useTable = FALSE) { - $form->_contactIds = array(); - $values = $form->controller->exportValues($form->get('searchFormName')); $form->_task = CRM_Utils_Array::value('task', $values); $mailingTasks = CRM_Mailing_Task::tasks(); $form->assign('taskName', CRM_Utils_Array::value('task', $values)); + // ids are mailing event queue ids $ids = array(); if ($values['radio_ts'] == 'ts_sel') { foreach ($values as $name => $value) { @@ -109,16 +101,15 @@ class CRM_Mailing_Form_Task extends CRM_Core_Form { $result = $query->searchQuery(0, 0, $sortOrder); while ($result->fetch()) { - $ids[] = $result->contact_id; + $ids[] = $result->mailing_event_queue_id; } $form->assign('totalSelectedMailingRecipients', $form->get('rowCount')); } if (!empty($ids)) { - $form->_componentClause = ' contact_a.id IN ( ' . implode(',', $ids) . ' ) '; + $form->_componentClause = ' civicrm_mailing_event_queue.id IN ( ' . implode(',', $ids) . ' ) '; } - $form->_contactIds = $ids; //set the context for redirection for any task actions $session = CRM_Core_Session::singleton(); diff --git a/CRM/Mailing/Selector/Search.php b/CRM/Mailing/Selector/Search.php index a805364ce4..5707e7ec97 100644 --- a/CRM/Mailing/Selector/Search.php +++ b/CRM/Mailing/Selector/Search.php @@ -299,7 +299,7 @@ class CRM_Mailing_Selector_Search extends CRM_Core_Selector_Base implements CRM_ } } - $row['checkbox'] = CRM_Core_Form::CB_PREFIX . $result->contact_id; + $row['checkbox'] = CRM_Core_Form::CB_PREFIX . $result->mailing_event_queue_id; $actions = array( 'cid' => $result->contact_id, -- 2.25.1