From: eileen Date: Thu, 9 Jan 2020 11:55:17 +0000 (+1300) Subject: [REF] rename lineItem & lineItems variable X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=19d97a67d153b3a9a8f3d710baa6f7be6ab4ff40;p=civicrm-core.git [REF] rename lineItem & lineItems variable Readability fix - =======Before======== refers to an array of lineItems, refers to a single lineItem =======After refers to an array of line items, refers to the single (created) line itmem --- diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index efa24b312b..328d542c1c 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -402,7 +402,7 @@ WHERE li.contribution_id = %1"; * Process price set and line items. * * @param int $entityId - * @param array $lineItem + * @param array $lineItems * Line item array. * @param object $contributionDetails * @param string $entityTable @@ -413,14 +413,14 @@ WHERE li.contribution_id = %1"; * @throws \CRM_Core_Exception * @throws \CiviCRM_API3_Exception */ - public static function processPriceSet($entityId, $lineItem, $contributionDetails = NULL, $entityTable = 'civicrm_contribution', $update = FALSE) { - if (!$entityId || !is_array($lineItem) - || CRM_Utils_System::isNull($lineItem) + public static function processPriceSet($entityId, $lineItems, $contributionDetails = NULL, $entityTable = 'civicrm_contribution', $update = FALSE) { + if (!$entityId || !is_array($lineItems) + || CRM_Utils_System::isNull($lineItems) ) { return; } - foreach ($lineItem as $priceSetId => &$values) { + foreach ($lineItems as $priceSetId => &$values) { if (!$priceSetId) { continue; } @@ -456,18 +456,18 @@ WHERE li.contribution_id = %1"; if (!empty($line['price_field_value_id']) && empty($line['financial_type_id'])) { $line['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $line['price_field_value_id'], 'financial_type_id'); } - $lineItems = CRM_Price_BAO_LineItem::create($line); + $createdLineItem = CRM_Price_BAO_LineItem::create($line); if (!$update && $contributionDetails) { - $financialItem = CRM_Financial_BAO_FinancialItem::add($lineItems, $contributionDetails); + $financialItem = CRM_Financial_BAO_FinancialItem::add($createdLineItem, $contributionDetails); $line['financial_item_id'] = $financialItem->id; if (!empty($line['tax_amount'])) { - CRM_Financial_BAO_FinancialItem::add($lineItems, $contributionDetails, TRUE); + CRM_Financial_BAO_FinancialItem::add($createdLineItem, $contributionDetails, TRUE); } } } } if (!$update && $contributionDetails) { - CRM_Core_BAO_FinancialTrxn::createDeferredTrxn($lineItem, $contributionDetails); + CRM_Core_BAO_FinancialTrxn::createDeferredTrxn($lineItems, $contributionDetails); } }