Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor code cleanup #13839

Merged
merged 1 commit into from
Mar 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions CRM/Contribute/Form/Contribution/ThankYou.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,11 @@ public function buildQuickForm() {
}

$params = $this->_params;
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$invoicing = CRM_Invoicing_Utils::isInvoicingEnabled();
// Make a copy of line items array to use for display only
$tplLineItems = $this->_lineItem;
if ($invoicing) {
$getTaxDetails = FALSE;
$taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
foreach ($this->_lineItem as $key => $value) {
foreach ($value as $k => $v) {
if (isset($v['tax_rate'])) {
Expand All @@ -126,7 +124,7 @@ public function buildQuickForm() {
}
}
$this->assign('getTaxDetails', $getTaxDetails);
$this->assign('taxTerm', $taxTerm);
$this->assign('taxTerm', CRM_Invoicing_Utils::getTaxTerm());
$this->assign('totalTaxAmount', $params['tax_amount']);
}

Expand Down
6 changes: 2 additions & 4 deletions CRM/Event/Form/Registration/ThankYou.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ public function buildQuickForm() {
}
$this->assignToTemplate();

$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
$taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$invoicing = CRM_Invoicing_Utils::isInvoicingEnabled();
$getTaxDetails = FALSE;
$taxAmount = 0;

Expand Down Expand Up @@ -129,7 +127,7 @@ public function buildQuickForm() {
if ($invoicing) {
$this->assign('getTaxDetails', $getTaxDetails);
$this->assign('totalTaxAmount', $taxAmount);
$this->assign('taxTerm', $taxTerm);
$this->assign('taxTerm', CRM_Invoicing_Utils::getTaxTerm());
}
$this->assign('totalAmount', $this->_totalAmount);

Expand Down
11 changes: 11 additions & 0 deletions CRM/Invoicing/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,15 @@ public static function getDefaultPaymentPage() {
return CRM_Utils_Array::value('default_invoice_page', $invoiceSettings);
}

/**
* Function to get the tax term.
*
* The value is nested in the contribution_invoice_settings setting - which
* is unsupported. Here we have a wrapper function to make later cleanup easier.
*/
public static function getTaxTerm() {
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
return CRM_Utils_Array::value('tax_term', $invoiceSettings);
}

}