From 148136aed73cf0a39ca05a6dfd8837b8af13cb33 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Wed, 15 Jun 2016 15:56:32 +0530 Subject: [PATCH] CRM-16189, modified function to sort option values with other column fields ---------------------------------------- * CRM-16189: Improve support for Accrual Method bookkeeping https://issues.civicrm.org/jira/browse/CRM-16189 --- CRM/Core/OptionGroup.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CRM/Core/OptionGroup.php b/CRM/Core/OptionGroup.php index c286e9dfc6..f4be86c75d 100644 --- a/CRM/Core/OptionGroup.php +++ b/CRM/Core/OptionGroup.php @@ -116,7 +116,8 @@ class CRM_Core_OptionGroup { public static function &values( $name, $flip = FALSE, $grouping = FALSE, $localize = FALSE, $condition = NULL, - $labelColumnName = 'label', $onlyActive = TRUE, $fresh = FALSE, $keyColumnName = 'value' + $labelColumnName = 'label', $onlyActive = TRUE, $fresh = FALSE, $keyColumnName = 'value', + $orderBy = 'weight' ) { $cache = CRM_Utils_Cache::singleton(); $cacheKey = self::createCacheKey($name, $flip, $grouping, $localize, $condition, $labelColumnName, $onlyActive, $keyColumnName); @@ -152,7 +153,7 @@ WHERE v.option_group_id = g.id $query .= $condition; } - $query .= " ORDER BY v.weight"; + $query .= " ORDER BY v.{$orderBy}"; $p = array(1 => array($name, 'String')); $dao = CRM_Core_DAO::executeQuery($query, $p); -- 2.25.1