Skip to content

Commit

Permalink
Merge pull request #20862 from eileenmcnaughton/leg_setting
Browse files Browse the repository at this point in the history
dev/core#2719 [REF] Remove some legacy references to contribution_invoice_settings
  • Loading branch information
mlutfy authored Jul 29, 2021
2 parents f66baff + fe4d128 commit fdb0407
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 27 deletions.
3 changes: 1 addition & 2 deletions CRM/Admin/Form/Preferences/Display.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
public function buildQuickForm() {

//changes for freezing the invoices/credit notes checkbox if invoicing is uncheck
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
$this->assign('invoicing', CRM_Invoicing_Utils::isInvoicingEnabled());
$this->assign('invoicing', Civi::settings()->get('invoicing'));

$this->addElement(
'xbutton',
Expand Down
4 changes: 1 addition & 3 deletions CRM/Contribute/Form/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -1675,9 +1675,7 @@ protected function submit($submittedValues, $action, $pledgePaymentID) {
* @param array $lineItem
*/
protected function invoicingPostProcessHook($submittedValues, $action, $lineItem) {

$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
if (empty($invoiceSettings['invoicing'])) {
if (!Civi::settings()->get('invoicing')) {
return;
}
$taxRate = [];
Expand Down
4 changes: 1 addition & 3 deletions CRM/Contribute/Form/Contribution/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -1105,9 +1105,7 @@ public static function processFormContribution(

$contribution = CRM_Contribute_BAO_Contribution::add($contributionParams);

$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
$invoicing = $invoiceSettings['invoicing'] ?? NULL;
if ($invoicing) {
if (Civi::settings()->get('invoicing')) {
$dataArray = [];
// @todo - interrogate the line items passed in on the params array.
// No reason to assume line items will be set on the form.
Expand Down
4 changes: 1 addition & 3 deletions CRM/Event/Form/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -1477,8 +1477,6 @@ public function submit($params) {
if ($this->_isPaidEvent) {
// fix amount for each of participants ( for bulk mode )
$eventAmount = [];
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
$invoicing = $invoiceSettings['invoicing'] ?? NULL;
$totalTaxAmount = 0;

//add dataArray in the receipts in ADD and UPDATE condition
Expand All @@ -1489,7 +1487,7 @@ public function submit($params) {
elseif ($this->_action & CRM_Core_Action::UPDATE) {
$line = $this->_values['line_items'];
}
if ($invoicing) {
if (Civi::settings()->get('invoicing')) {
foreach ($line as $key => $value) {
if (isset($value['tax_amount'])) {
$totalTaxAmount += $value['tax_amount'];
Expand Down
12 changes: 1 addition & 11 deletions CRM/Financial/BAO/FinancialType.php
Original file line number Diff line number Diff line change
Expand Up @@ -476,17 +476,7 @@ public static function checkPermissionToEditFinancialType($financialTypeID) {
* @return bool
*/
public static function isACLFinancialTypeStatus() {
if (!isset(\Civi::$statics[__CLASS__]['is_acl_enabled'])) {
\Civi::$statics[__CLASS__]['is_acl_enabled'] = FALSE;
$realSetting = \Civi::$statics[__CLASS__]['is_acl_enabled'] = Civi::settings()->get('acl_financial_type');
if (!$realSetting) {
$contributeSettings = Civi::settings()->get('contribution_invoice_settings');
if (!empty($contributeSettings['acl_financial_type'])) {
\Civi::$statics[__CLASS__]['is_acl_enabled'] = TRUE;
}
}
}
return \Civi::$statics[__CLASS__]['is_acl_enabled'];
return Civi::settings()->get('acl_financial_type');
}

}
6 changes: 1 addition & 5 deletions CRM/Invoicing/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ public static function onToggle($oldValue, $newValue, $metadata) {
* We check both here. But will deprecate the latter in time.
*/
public static function isInvoicingEnabled() {
if (Civi::settings()->get('invoicing')) {
return TRUE;
}
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
return $invoiceSettings['invoicing'] ?? NULL;
return Civi::settings()->get('invoicing');
}

/**
Expand Down

0 comments on commit fdb0407

Please sign in to comment.