CRM-19288, fixed civicrm_contribution.tax_amount value for multiple participant regis...
authorPradeep Nayak <pradpnayak@gmail.com>
Thu, 15 Dec 2016 15:54:58 +0000 (21:24 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Fri, 23 Dec 2016 13:43:51 +0000 (19:13 +0530)
----------------------------------------
* CRM-19288: VAT not included for additional participant fee when registering for events
  https://issues.civicrm.org/jira/browse/CRM-19288

CRM/Event/Form/Registration/Confirm.php

index e08c82d13592667bbee37708559938829c636f97..77ce52fe963ed49119489ea6f17ae0a849f515e2 100644 (file)
@@ -430,6 +430,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
       $this->set('finalAmount', $this->_amount);
     }
     $participantCount = array();
+    $taxAmount = $totalTaxAmount = 0;
 
     //unset the skip participant from params.
     //build the $participantCount array.
@@ -442,7 +443,10 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
       elseif ($participantNum) {
         $participantCount[$participantNum] = 'participant';
       }
-
+      $totalTaxAmount += CRM_Utils_Array::value('tax_amount', $record, 0);
+      if (CRM_Utils_Array::value('is_primary', $record)) {
+        $taxAmount = &$params[$participantNum]['tax_amount'];
+      }
       //lets get additional participant id to cancel.
       if ($this->_allowConfirmation && is_array($cancelledIds)) {
         $additonalId = CRM_Utils_Array::value('participant_id', $record);
@@ -451,7 +455,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
         }
       }
     }
-
+    $taxAmount = $totalTaxAmount;
     $payment = $registerByID = $primaryCurrencyID = $contribution = NULL;
     $paymentObjError = ts('The system did not record payment details for this payment and so could not process the transaction. Please report this error to the site administrator.');