From 85ade0ae338d25df1c0a947d4be3028dad0bf2fe Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Fri, 16 Dec 2016 16:31:24 +0530 Subject: [PATCH] CRM-19777: Edit contribution : wrong decimal separator on total_amount --- CRM/Member/Form/MembershipRenewal.php | 4 ++++ tests/phpunit/CRM/Member/Form/MembershipRenewalTest.php | 2 ++ 2 files changed, 6 insertions(+) diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index 5c73bca436..3f7b106c6a 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -639,6 +639,10 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { 'membership_id' => $renewMembership->id, 'contribution_recur_id' => $contributionRecurID, )); + //Remove `tax_amount` if it is not calculated. + if (CRM_Utils_Array::value('tax_amount', $temporaryParams) === 0) { + unset($temporaryParams['tax_amount']); + } CRM_Member_BAO_Membership::recordMembershipContribution($temporaryParams); } diff --git a/tests/phpunit/CRM/Member/Form/MembershipRenewalTest.php b/tests/phpunit/CRM/Member/Form/MembershipRenewalTest.php index 45e08918a8..0178ed745f 100644 --- a/tests/phpunit/CRM/Member/Form/MembershipRenewalTest.php +++ b/tests/phpunit/CRM/Member/Form/MembershipRenewalTest.php @@ -404,8 +404,10 @@ class CRM_Member_Form_MembershipRenewalTest extends CiviUnitTestCase { $contribution = $this->callAPISuccessGetSingle('Contribution', array( 'contact_id' => $this->_individualId, 'contribution_status_id' => 2, + 'return' => array("tax_amount", "trxn_id"), )); $this->assertEquals($contribution['trxn_id'], 777); + $this->assertEquals($contribution['tax_amount'], NULL); $this->callAPISuccessGetCount('LineItem', array( 'entity_id' => $membership['id'], -- 2.25.1