diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index 9b0ef7cc06a1..ed7a1003719f 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -154,18 +154,16 @@ public static function getAPILineItemParams(&$params) { } /** - * @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; }