CRM-14861 - Add order by to getLineItems function so that line-items in participant...
authorDave Greenberg <dave@civicrm.org>
Sat, 21 Jun 2014 00:55:10 +0000 (17:55 -0700)
committerDave Greenberg <dave@civicrm.org>
Sat, 21 Jun 2014 00:55:10 +0000 (17:55 -0700)
----------------------------------------
* CRM-14861:
  https://issues.civicrm.org/jira/browse/CRM-14861

CRM/Price/BAO/LineItem.php

index db938fc0922ca0d434cf5e3009223d679ea0e099..cb6e6f19e119dd2b5684b72d5311bac1bb157421 100644 (file)
@@ -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;