From: Dave Greenberg Date: Sat, 21 Jun 2014 00:55:10 +0000 (-0700) Subject: CRM-14861 - Add order by to getLineItems function so that line-items in participant... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e68f41a57b8a3a90e1aa36d7dc38ed993e60d562;p=civicrm-core.git 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 --- 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;