CRM-16189, changed function defination
authorPradeep Nayak <pradpnayak@gmail.com>
Tue, 20 Sep 2016 10:48:37 +0000 (16:18 +0530)
committerEdsel <edsel.lopez@jmaconsulting.biz>
Mon, 19 Dec 2016 09:28:22 +0000 (14:58 +0530)
----------------------------------------
* CRM-16189: Improve support for Accrual Method bookkeeping
  https://issues.civicrm.org/jira/browse/CRM-16189

CRM/Price/BAO/LineItem.php

index 0d0d6ad520f04174d8b93c5705fe4a0b5a8f83f3..e721e3abe37bdf461173eff59618d0d15f8e6628 100644 (file)
@@ -162,18 +162,16 @@ class CRM_Price_BAO_LineItem extends CRM_Price_DAO_LineItem {
   }
 
   /**
-   * @param int $entityId
-   * @param $entityTable
+   * @param int $contributionId
    *
    * @return null|string
    */
-  public static function getLineTotal($entityId, $entityTable) {
+  public static function getLineTotal($contributionId) {
     $sqlLineItemTotal = "SELECT SUM(li.line_total + COALESCE(li.tax_amount,0))
 FROM civicrm_line_item li
-WHERE li.entity_table = '{$entityTable}'
-AND li.entity_id = {$entityId}
-";
-    $lineItemTotal = CRM_Core_DAO::singleValueQuery($sqlLineItemTotal);
+WHERE li.contribution_id = %1";
+    $params = array(1 => array($contributionId, 'Integer'));
+    $lineItemTotal = CRM_Core_DAO::singleValueQuery($sqlLineItemTotal, $params);
     return $lineItemTotal;
   }