Merge pull request #2459 from deepak-srivastava/CRM-14128
[civicrm-core.git] / CRM / Mailing / Form / Task.php
index 7076b296c70e2f00cfda839af02206c5f79e249a..055985eed81d8aa6eb18cf770953d528f4b3335d 100644 (file)
@@ -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_recipients_id;
       }
       $form->assign('totalSelectedMailingRecipients', $form->get('rowCount'));
     }
 
     if (!empty($ids)) {
-      $form->_componentClause =  ' contact_a.id IN ( ' . implode(',', $ids) . ' ) ';
+      $form->_componentClause =  ' civicrm_mailing_recipients.id IN ( ' . implode(',', $ids) . ' ) ';
     }
 
-    $form->_contactIds = $ids;
     //set the context for redirection for any task actions
     $session = CRM_Core_Session::singleton();