Skip to content

Commit

Permalink
Merge pull request #19228 from eileenmcnaughton/inv_assign
Browse files Browse the repository at this point in the history
Remove duplicated tax assignments from copied code
  • Loading branch information
seamuslee001 authored Dec 18, 2020
2 parents 468c340 + 7f2c42b commit 4454262
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions CRM/Member/Form/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,8 @@ public function submit() {
$isRecur, $calcDates));
}

// This would always be true as we always add price set id into both
// quick config & non quick config price sets.
if (!empty($lineItem[$this->_priceSetId])) {
$invoicing = Civi::settings()->get('invoicing');
$taxAmount = FALSE;
Expand Down Expand Up @@ -1935,29 +1937,6 @@ public static function processFormContribution(

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

$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
$invoicing = $invoiceSettings['invoicing'] ?? NULL;
if ($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.
foreach ($form->_lineItem as $lineItemKey => $lineItemValue) {
foreach ($lineItemValue as $key => $value) {
if (isset($value['tax_amount']) && isset($value['tax_rate'])) {
if (isset($dataArray[$value['tax_rate']])) {
$dataArray[$value['tax_rate']] = $dataArray[$value['tax_rate']] + $value['tax_amount'];
}
else {
$dataArray[$value['tax_rate']] = $value['tax_amount'];
}
}
}
}
$smarty = CRM_Core_Smarty::singleton();
$smarty->assign('dataArray', $dataArray);
$smarty->assign('totalTaxAmount', $params['tax_amount'] ?? NULL);
}

// lets store it in the form variable so postProcess hook can get to this and use it
$form->_contributionID = $contribution->id;
}
Expand Down

0 comments on commit 4454262

Please sign in to comment.