From: eileen Date: Mon, 25 Nov 2019 02:59:12 +0000 (+1300) Subject: Fix deprecation warning on Price Set report X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1aa104c55c3a2b0dc499d922d81421615df85641;p=civicrm-core.git Fix deprecation warning on Price Set report In 5.20 we added a deprecation warning on searches that are borked WRT filling the prev_next cache & hence doing searches. The price set search falls into this camp & while it has been broken forever the deprecation notice is new (& the fix is safe) so targettin 5.20 --- diff --git a/CRM/Contact/Selector.php b/CRM/Contact/Selector.php index faf4e64e2d..7e7560a34f 100644 --- a/CRM/Contact/Selector.php +++ b/CRM/Contact/Selector.php @@ -1016,6 +1016,8 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se * @param string $cacheKey * @param int $start * @param int $end + * + * @throws \CRM_Core_Exception */ public function fillupPrevNextCache($sort, $cacheKey, $start = 0, $end = self::CACHE_SIZE) { $coreSearch = TRUE; @@ -1041,7 +1043,9 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se $selectSQL = CRM_Core_DAO::composeQuery("SELECT DISTINCT %1, contact_a.id, contact_a.sort_name", [1 => [$cacheKey, 'String']]); - $sql = str_ireplace(["SELECT contact_a.id as contact_id", "SELECT contact_a.id as id"], $selectSQL, $sql); + $sql = str_ireplace(['SELECT contact_a.id as contact_id', 'SELECT contact_a.id as id'], $selectSQL, $sql); + $sql = str_ireplace('ORDER BY `contact_id`', 'ORDER BY `id`', $sql, $sql); + try { Civi::service('prevnext')->fillWithSql($cacheKey, $sql); }