From 1703683bd839234e180c95996b35b71fe3f4ae7f Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Tue, 19 Dec 2023 00:03:35 +0000 Subject: [PATCH] Replace deprecated invoice settings --- CRM/Contribute/BAO/Contribution.php | 2 +- CRM/Contribute/BAO/FinancialProcessor.php | 2 +- CRM/Contribute/Form/Contribution.php | 5 ++--- CRM/Contribute/Form/ContributionView.php | 2 +- CRM/Contribute/Page/UserDashboard.php | 2 +- CRM/Contribute/Task.php | 2 +- CRM/Event/Form/Registration/ThankYou.php | 2 +- CRM/Financial/Form/FrontEndPaymentFormTrait.php | 4 ++-- 8 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 376c9b8ecc..e97ffe9b3e 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -106,7 +106,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution im //set defaults in create mode if (!$contributionID) { CRM_Core_DAO::setCreateDefaults($params, self::getDefaults()); - if (empty($params['invoice_number']) && CRM_Invoicing_Utils::isInvoicingEnabled()) { + if (empty($params['invoice_number']) && \Civi::settings()->get('invoicing')) { $nextContributionID = CRM_Core_DAO::singleValueQuery("SELECT COALESCE(MAX(id) + 1, 1) FROM civicrm_contribution"); $params['invoice_number'] = self::getInvoiceNumber($nextContributionID); } diff --git a/CRM/Contribute/BAO/FinancialProcessor.php b/CRM/Contribute/BAO/FinancialProcessor.php index 73056b55da..9097a1164d 100644 --- a/CRM/Contribute/BAO/FinancialProcessor.php +++ b/CRM/Contribute/BAO/FinancialProcessor.php @@ -108,7 +108,7 @@ class CRM_Contribute_BAO_FinancialProcessor { } if ($taxAmount != 0) { $itemParams['amount'] = CRM_Contribute_BAO_FinancialProcessor::getMultiplier($params['contribution']->contribution_status_id, $context) * $taxAmount; - $itemParams['description'] = CRM_Invoicing_Utils::getTaxTerm(); + $itemParams['description'] = \Civi::settings()->get('tax_term'); if ($lineItemDetails['financial_type_id']) { $itemParams['financial_account_id'] = CRM_Financial_BAO_FinancialAccount::getSalesTaxFinancialAccount($lineItemDetails['financial_type_id']); } diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 6f7f033eb7..31b980012d 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -600,8 +600,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // build price set form. $buildPriceSet = FALSE; - $invoicing = CRM_Invoicing_Utils::isInvoicingEnabled(); - $this->assign('invoicing', CRM_Invoicing_Utils::isInvoicingEnabled()); + $this->assign('invoicing', \Civi::settings()->get('invoicing')); // This is a probably-deprecated approach to partial payments - assign here // & if true it will be overwritten. $this->assign('payNow', FALSE); @@ -1706,7 +1705,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP ]); $this->_id = $params['id']; $this->_values = $existingContribution; - if (CRM_Invoicing_Utils::isInvoicingEnabled()) { + if (\Civi::settings()->get('invoicing')) { $this->_values['tax_amount'] = civicrm_api3('contribution', 'getvalue', [ 'id' => $params['id'], 'return' => 'tax_amount', diff --git a/CRM/Contribute/Form/ContributionView.php b/CRM/Contribute/Form/ContributionView.php index 5edd85bb46..489bea9eb1 100644 --- a/CRM/Contribute/Form/ContributionView.php +++ b/CRM/Contribute/Form/ContributionView.php @@ -205,7 +205,7 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form { // assign values to the template $this->assignVariables($values, array_keys($values)); - $invoicing = CRM_Invoicing_Utils::isInvoicingEnabled(); + $invoicing = \Civi::settings()->get('invoicing'); $this->assign('invoicing', $invoicing); $this->assign('isDeferred', Civi::settings()->get('deferred_revenue_enabled')); if ($invoicing && isset($values['tax_amount'])) { diff --git a/CRM/Contribute/Page/UserDashboard.php b/CRM/Contribute/Page/UserDashboard.php index cdb2745468..5da9f38cc8 100644 --- a/CRM/Contribute/Page/UserDashboard.php +++ b/CRM/Contribute/Page/UserDashboard.php @@ -123,7 +123,7 @@ class CRM_Contribute_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBo * (currently CRM_Utils_Invoicing) with a view to possible removal from core. */ public function isIncludeInvoiceLinks() { - if (!CRM_Invoicing_Utils::isInvoicingEnabled()) { + if (!\Civi::settings()->get('invoicing')) { return FALSE; } $dashboardOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, diff --git a/CRM/Contribute/Task.php b/CRM/Contribute/Task.php index 3fa495d852..cf80e77e21 100644 --- a/CRM/Contribute/Task.php +++ b/CRM/Contribute/Task.php @@ -133,7 +133,7 @@ class CRM_Contribute_Task extends CRM_Core_Task { } // remove action "Invoices - print or email" - $invoicing = CRM_Invoicing_Utils::isInvoicingEnabled(); + $invoicing = \Civi::settings()->get('invoicing'); if (!$invoicing) { unset(self::$_tasks[self::PDF_INVOICE]); } diff --git a/CRM/Event/Form/Registration/ThankYou.php b/CRM/Event/Form/Registration/ThankYou.php index 474e3d5f8d..eef8c16402 100644 --- a/CRM/Event/Form/Registration/ThankYou.php +++ b/CRM/Event/Form/Registration/ThankYou.php @@ -85,7 +85,7 @@ class CRM_Event_Form_Registration_ThankYou extends CRM_Event_Form_Registration { $this->assignToTemplate(); - $invoicing = CRM_Invoicing_Utils::isInvoicingEnabled(); + $invoicing = \Civi::settings()->get('invoicing'); $taxAmount = 0; $lineItemForTemplate = []; diff --git a/CRM/Financial/Form/FrontEndPaymentFormTrait.php b/CRM/Financial/Form/FrontEndPaymentFormTrait.php index 19db6f15af..9077f5940e 100644 --- a/CRM/Financial/Form/FrontEndPaymentFormTrait.php +++ b/CRM/Financial/Form/FrontEndPaymentFormTrait.php @@ -113,7 +113,7 @@ trait CRM_Financial_Form_FrontEndPaymentFormTrait { * @param array $tplLineItems */ protected function alterLineItemsForTemplate(&$tplLineItems) { - if (!CRM_Invoicing_Utils::isInvoicingEnabled()) { + if (!\Civi::settings()->get('invoicing')) { return; } // @todo this should really be the first time we are determining @@ -128,7 +128,7 @@ trait CRM_Financial_Form_FrontEndPaymentFormTrait { if (isset($v['tax_rate']) && $v['tax_rate'] != '') { // These only need assigning once, but code is more readable with them here $this->assign('getTaxDetails', TRUE); - $this->assign('taxTerm', CRM_Invoicing_Utils::getTaxTerm()); + $this->assign('taxTerm', \Civi::settings()->get('tax_term')); // Cast to float to display without trailing zero decimals $tplLineItems[$key][$k]['tax_rate'] = (float) $v['tax_rate']; } -- 2.25.1