From: Johan Vervloet Date: Mon, 14 Dec 2015 15:48:49 +0000 (+0100) Subject: CRM-14920 - labels from custom search: honor sort order. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=211c4cb1de75da6ea3cf9407505d0234827e969e;p=civicrm-core.git CRM-14920 - labels from custom search: honor sort order. This fixes the issue when you manually select a number of rows from the custom search results. It does not work when you want to create labels for all results. ---------------------------------------- * CRM-14920: Custom Searches do not honor user sort order https://issues.civicrm.org/jira/browse/CRM-14920 --- diff --git a/CRM/Contact/Form/Task.php b/CRM/Contact/Form/Task.php index 9e0ab17f62..731ab2ffc7 100644 --- a/CRM/Contact/Form/Task.php +++ b/CRM/Contact/Form/Task.php @@ -190,9 +190,7 @@ class CRM_Contact_Form_Task extends CRM_Core_Form { // and it decides when to use distinct based on input criteria, which needs // to be fixed and optimized. - foreach ($allCids[$cacheKey] as $cid => $ignore) { - $form->_contactIds[] = $cid; - } + $form->_contactIds = array_unique($allCids[$cacheKey]); } } elseif (CRM_Utils_Array::value('radio_ts', self::$_searchFormValues) == 'ts_sel') { @@ -313,7 +311,7 @@ class CRM_Contact_Form_Task extends CRM_Core_Form { $contactIds = array(); while ($dao->fetch()) { - $contactIds[$dao->contact_id] = $dao->contact_id; + $contactIds[] = $dao->contact_id; } return $contactIds;