From b4df5f600d83f76e04ba4db89ff21406696b235e Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Tue, 31 Mar 2015 19:37:46 +0530 Subject: [PATCH] -- CRM-15848, fixed code to point civicrm_financial_item to latest financial trxn ---------------------------------------- * CRM-15848: Civiaccounts inconsistent with spec when adding partial event payment https://issues.civicrm.org/jira/browse/CRM-15848 --- CRM/Event/BAO/Participant.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index ec1baa59cb..ea4e7e521d 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -1922,16 +1922,15 @@ GROUP BY li.entity_table, li.entity_id, price_field_value_id if (!in_array($updateFinancialItemInfoValues['price_field_value_id'], $submittedFieldValueIds) && $updateFinancialItemInfoValues['differenceAmt'] != 0) { // INSERT negative financial_items $updateFinancialItemInfoValues['amount'] = -$updateFinancialItemInfoValues['amount']; - CRM_Financial_BAO_FinancialItem::create($updateFinancialItemInfoValues, NULL, $trxnId); - // INSERT negative financial_items for tax amount if ($previousLineItems[$updateFinancialItemInfoValues['entity_id']]['tax_amount']) { - $updateFinancialItemInfoValues['amount'] = -($previousLineItems[$updateFinancialItemInfoValues['entity_id']]['tax_amount']); - $updateFinancialItemInfoValues['description'] = $taxTerm; + $updateFinancialItemInfoValues['tax']['amount'] = -($previousLineItems[$updateFinancialItemInfoValues['entity_id']]['tax_amount']); + $updateFinancialItemInfoValues['tax']['description'] = $taxTerm; if ($updateFinancialItemInfoValues['financial_type_id']) { - $updateFinancialItemInfoValues['financial_account_id'] = CRM_Contribute_BAO_Contribution::getFinancialAccountId($updateFinancialItemInfoValues['financial_type_id']); + $updateFinancialItemInfoValues['tax']['financial_account_id'] = CRM_Contribute_BAO_Contribution::getFinancialAccountId($updateFinancialItemInfoValues['financial_type_id']); } - CRM_Financial_BAO_FinancialItem::create($updateFinancialItemInfoValues, NULL, $trxnId); } + // INSERT negative financial_items for tax amount + $financialItemsArray[] = $updateFinancialItemInfoValues; } // if submitted and difference is 0 add a positive entry again elseif (in_array($updateFinancialItemInfoValues['price_field_value_id'], $submittedFieldValueIds) && $updateFinancialItemInfoValues['differenceAmt'] == 0) { -- 2.25.1