From e9b4319f1d141c261a584d9601c549b9b2044755 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 12 Aug 2021 16:36:03 +1200 Subject: [PATCH] [REF] Update a few references to invoicing --- CRM/Event/Form/ParticipantView.php | 4 +--- CRM/Event/Page/EventInfo.php | 4 ++-- CRM/Price/BAO/LineItem.php | 4 +--- CRM/Price/Page/Field.php | 4 +--- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/CRM/Event/Form/ParticipantView.php b/CRM/Event/Form/ParticipantView.php index 57e4af7ecd91..db19ee9c6e4d 100644 --- a/CRM/Event/Form/ParticipantView.php +++ b/CRM/Event/Form/ParticipantView.php @@ -192,8 +192,6 @@ public function preProcess() { $displayName = CRM_Contact_BAO_Contact::displayName($values[$participantID]['contact_id']); $participantCount = []; - $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); - $invoicing = $invoiceSettings['invoicing'] ?? NULL; $totalTaxAmount = 0; foreach ($lineItem as $k => $v) { if (CRM_Utils_Array::value('participant_count', $lineItem[$k]) > 0) { @@ -201,7 +199,7 @@ public function preProcess() { } $totalTaxAmount = $v['tax_amount'] + $totalTaxAmount; } - if ($invoicing) { + if (Civi::settings()->get('invoicing')) { $this->assign('totalTaxAmount', $totalTaxAmount); } if ($participantCount) { diff --git a/CRM/Event/Page/EventInfo.php b/CRM/Event/Page/EventInfo.php index fe358a051c05..5dcac3363ffd 100644 --- a/CRM/Event/Page/EventInfo.php +++ b/CRM/Event/Page/EventInfo.php @@ -130,7 +130,7 @@ public function run() { $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $taxTerm = Civi::settings()->get('tax_term'); $displayOpt = $invoiceSettings['tax_display_settings'] ?? NULL; - $invoicing = $invoiceSettings['invoicing'] ?? NULL; + foreach ($fieldValues['options'] as $optionId => $optionVal) { if (CRM_Utils_Array::value('visibility_id', $optionVal) != array_search('public', $visibility) && $adminFieldVisible == FALSE @@ -139,7 +139,7 @@ public function run() { } $values['feeBlock']['isDisplayAmount'][$fieldCnt] = $fieldValues['is_display_amounts'] ?? NULL; - if ($invoicing && isset($optionVal['tax_amount'])) { + if (Civi::settings()->get('invoicing') && isset($optionVal['tax_amount'])) { $values['feeBlock']['value'][$fieldCnt] = CRM_Price_BAO_PriceField::getTaxLabel($optionVal, 'amount', $displayOpt, $taxTerm); $values['feeBlock']['tax_amount'][$fieldCnt] = $optionVal['tax_amount']; } diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index 618765423840..d876651411c4 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -214,8 +214,6 @@ public static function getLineItems($entityId, $entity = 'participant', $isQuick ]; $getTaxDetails = FALSE; - $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); - $invoicing = $invoiceSettings['invoicing'] ?? NULL; $dao = CRM_Core_DAO::executeQuery("$selectClause $fromClause $whereClause $orderByClause", $params); while ($dao->fetch()) { @@ -257,7 +255,7 @@ public static function getLineItems($entityId, $entity = 'participant', $isQuick $getTaxDetails = TRUE; } } - if ($invoicing) { + if (Civi::settings()->get('invoicing')) { // @todo - this is an inappropriate place to be doing form level assignments. $taxTerm = Civi::settings()->get('tax_term'); $smarty = CRM_Core_Smarty::singleton(); diff --git a/CRM/Price/Page/Field.php b/CRM/Price/Page/Field.php index d59d9a0eaec8..71cec4233d06 100644 --- a/CRM/Price/Page/Field.php +++ b/CRM/Price/Page/Field.php @@ -108,9 +108,7 @@ public function browse() { $priceFieldBAO->find(); // display taxTerm for priceFields - $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $taxTerm = Civi::settings()->get('tax_term'); - $invoicing = $invoiceSettings['invoicing'] ?? NULL; $getTaxDetails = FALSE; $taxRate = CRM_Core_PseudoConstant::getTaxRates(); CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes); @@ -126,7 +124,7 @@ public function browse() { CRM_Price_BAO_PriceFieldValue::retrieve($params, $optionValues); $priceField[$priceFieldBAO->id]['price'] = $optionValues['amount'] ?? NULL; $financialTypeId = $optionValues['financial_type_id']; - if ($invoicing && isset($taxRate[$financialTypeId])) { + if (Civi::settings()->get('invoicing') && isset($taxRate[$financialTypeId])) { $priceField[$priceFieldBAO->id]['tax_rate'] = $taxRate[$financialTypeId]; $getTaxDetails = TRUE; }