Skip to content

Commit

Permalink
Merge pull request #14562 from agileware/CIVICRM-1244
Browse files Browse the repository at this point in the history
dev/core#1049: Use FrontEndPaymentFormTrait to assign line items…
  • Loading branch information
seamuslee001 authored Jun 18, 2019
2 parents 09f35f8 + 1dacd56 commit 63f2508
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
12 changes: 2 additions & 10 deletions CRM/Event/Form/Registration/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
* This class generates form components for processing Event.
*/
class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
use CRM_Financial_Form_FrontEndPaymentFormTrait;

/**
* The values for the contribution db object.
Expand Down Expand Up @@ -297,25 +298,16 @@ public function buildQuickForm() {

if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) {
$lineItemForTemplate = [];
$getTaxDetails = FALSE;
if (!empty($this->_lineItem) && is_array($this->_lineItem)) {
foreach ($this->_lineItem as $key => $value) {
if (!empty($value)) {
$lineItemForTemplate[$key] = $value;
}
if ($invoicing) {
foreach ($value as $v) {
if (isset($v['tax_rate'])) {
$getTaxDetails = TRUE;
}
}
}
}
}
if (!empty($lineItemForTemplate)) {
$this->assign('lineItem', $lineItemForTemplate);
$this->assignLineItemsToTemplate($lineItemForTemplate);
}
$this->assign('getTaxDetails', $getTaxDetails);
}

//display additional participants profile.
Expand Down
7 changes: 2 additions & 5 deletions CRM/Event/Form/Registration/ThankYou.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
*
*/
class CRM_Event_Form_Registration_ThankYou extends CRM_Event_Form_Registration {
use CRM_Financial_Form_FrontEndPaymentFormTrait;

/**
* Set variables up before form is built.
Expand Down Expand Up @@ -97,7 +98,6 @@ public function buildQuickForm() {
$this->assignToTemplate();

$invoicing = CRM_Invoicing_Utils::isInvoicingEnabled();
$getTaxDetails = FALSE;
$taxAmount = 0;

$lineItemForTemplate = [];
Expand All @@ -109,7 +109,6 @@ public function buildQuickForm() {
foreach ($value as $v) {
if (isset($v['tax_amount']) || isset($v['tax_rate'])) {
$taxAmount += $v['tax_amount'];
$getTaxDetails = TRUE;
}
}
}
Expand All @@ -121,13 +120,11 @@ public function buildQuickForm() {
!CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config') &&
!empty($lineItemForTemplate)
) {
$this->assign('lineItem', $lineItemForTemplate);
$this->assignLineItemsToTemplate($lineItemForTemplate);
}

if ($invoicing) {
$this->assign('getTaxDetails', $getTaxDetails);
$this->assign('totalTaxAmount', $taxAmount);
$this->assign('taxTerm', CRM_Invoicing_Utils::getTaxTerm());
}
$this->assign('totalAmount', $this->_totalAmount);

Expand Down

0 comments on commit 63f2508

Please sign in to comment.