Skip to content

Commit

Permalink
Fix calculation of tax on line item amount (#1017)
Browse files Browse the repository at this point in the history
  • Loading branch information
jitendrapurohit authored Nov 16, 2024
1 parent ad45b61 commit 38536d4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/WebformCivicrmPostProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -1686,6 +1686,7 @@ private function processGrants() {
* Calculate line-items for this webform submission
*/
private function tallyLineItems() {
$submittedFormValues = $this->form_state->getUserInput();
// Contribution
$fid = 'civicrm_1_contribution_1_contribution_total_amount';
if (isset($this->enabled[$fid]) || $this->getData($fid) > 0) {
Expand All @@ -1703,7 +1704,7 @@ private function tallyLineItems() {
if (isset($this->enabled[$fid])) {
foreach ($this->data['lineitem'][1]['contribution'] as $n => $lineitem) {
$fid = "civicrm_1_lineitem_{$n}_contribution_line_total";
if ($this->getData($fid) != 0) {
if (!isset($submittedFormValues[$fid]) || $this->getData($fid) != 0) {
$this->line_items[] = [
'qty' => 1,
'unit_price' => $lineitem['line_total'],
Expand Down Expand Up @@ -1738,6 +1739,7 @@ private function tallyLineItems() {
};

if ($price) {
$member_name = NULL;
if (!empty($this->data['contact'][$c]['contact'][$n])) {
$member_contact = $this->data['contact'][$c]['contact'][$n];
if (!empty($member_contact['first_name']) && !empty($member_contact['last_name'])) {
Expand Down

0 comments on commit 38536d4

Please sign in to comment.