CRM-14875 - Make sure line items show up for any contribution, event reg or membershi...
authorDave Greenberg <dave@civicrm.org>
Thu, 19 Jun 2014 17:47:24 +0000 (10:47 -0700)
committerDave Greenberg <dave@civicrm.org>
Thu, 19 Jun 2014 17:47:24 +0000 (10:47 -0700)
----------------------------------------
* CRM-14875:
  https://issues.civicrm.org/jira/browse/CRM-14875

CRM/Price/BAO/LineItem.php

index b8eb7543deff01caa9120795c4ad6cffa67363b1..db938fc0922ca0d434cf5e3009223d679ea0e099 100644 (file)
@@ -141,7 +141,9 @@ AND li.entity_id = {$entityId}
 
     $fromClause = "
       FROM      civicrm_%2 as %2
-      LEFT JOIN civicrm_line_item li ON ( li.entity_id = %2.id AND li.entity_table = 'civicrm_%2')
+      LEFT JOIN civicrm_line_item li ON (( li.entity_id = %2.id AND li.entity_table = 'civicrm_%2')
+        OR (li.contribution_id = %2.id AND li.entity_table = 'civicrm_membership')
+        OR (li.contribution_id = %2.id AND li.entity_table = 'civicrm_participant'))
       LEFT JOIN civicrm_price_field_value pfv ON ( pfv.id = li.price_field_value_id )
       LEFT JOIN civicrm_price_field pf ON (pf.id = li.price_field_id )";
     $whereClause = "
@@ -167,7 +169,7 @@ AND li.entity_id = {$entityId}
       2 => array($entity, 'Text'),
     );
 
-    $dao = CRM_Core_DAO::executeQuery("$selectClause $fromClause $whereClause", $params);
+    $dao = CRM_Core_DAO::executeQuery("$selectClause $fromClause $whereClause ORDER by li.id", $params);
     while ($dao->fetch()) {
       if (!$dao->id) {
         continue;