From e68f41a57b8a3a90e1aa36d7dc38ed993e60d562 Mon Sep 17 00:00:00 2001 From: Dave Greenberg Date: Fri, 20 Jun 2014 17:55:10 -0700 Subject: [PATCH] CRM-14861 - Add order by to getLineItems function so that line-items in participant, membership and contribution view pages as well as receipt emails are ordered by price field and price field value weight. ---------------------------------------- * CRM-14861: https://issues.civicrm.org/jira/browse/CRM-14861 --- CRM/Price/BAO/LineItem.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index db938fc092..cb6e6f19e1 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -149,6 +149,8 @@ AND li.entity_id = {$entityId} $whereClause = " WHERE %2.id = %1"; + $orderByClause = " ORDER BY pf.weight, pfv.weight"; + if ($isQuick) { $fromClause .= " LEFT JOIN civicrm_price_set cps on cps.id = pf.price_set_id "; $whereClause .= " and cps.is_quick_config = 0"; @@ -169,7 +171,7 @@ AND li.entity_id = {$entityId} 2 => array($entity, 'Text'), ); - $dao = CRM_Core_DAO::executeQuery("$selectClause $fromClause $whereClause ORDER by li.id", $params); + $dao = CRM_Core_DAO::executeQuery("$selectClause $fromClause $whereClause $orderByClause", $params); while ($dao->fetch()) { if (!$dao->id) { continue; -- 2.25.1