From f49cdeab3a9749f011c4b5387c44ff02d7d634e3 Mon Sep 17 00:00:00 2001 From: "deb.monish" Date: Mon, 29 May 2017 20:59:13 +0530 Subject: [PATCH] CRM-20651: Change partial_amount_pay to partial_amount_to_pay for Partial Payment workflow --- CRM/Contribute/BAO/Contribution.php | 12 ++++++------ CRM/Event/Form/Participant.php | 4 ++-- .../phpunit/CRM/Contribute/BAO/ContributionTest.php | 4 ++-- .../CRM/Contribute/Form/AdditionalPaymentTest.php | 2 +- .../phpunit/CRM/Event/BAO/AdditionalPaymentTest.php | 2 +- tests/phpunit/CRM/Event/BAO/CRM19273Test.php | 2 +- tests/phpunit/CiviTest/CiviUnitTestCase.php | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 64e0ed7596..e42b0909e1 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -179,9 +179,9 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { $setPrevContribution = TRUE; // CRM-13964 partial payment - if (!empty($params['partial_payment_total']) && !empty($params['partial_amount_pay'])) { + if (!empty($params['partial_payment_total']) && !empty($params['partial_amount_to_pay'])) { $partialAmtTotal = $params['partial_payment_total']; - $partialAmtPay = $params['partial_amount_pay']; + $partialAmtPay = $params['partial_amount_to_pay']; $params['total_amount'] = $partialAmtTotal; if ($partialAmtPay < $partialAmtTotal) { $params['contribution_status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Partially paid'); @@ -3168,9 +3168,9 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac $statusId = $params['contribution']->contribution_status_id; // CRM-13964 partial payment if ($contributionStatus == 'Partially paid' - && !empty($params['partial_payment_total']) && !empty($params['partial_amount_pay']) + && !empty($params['partial_payment_total']) && !empty($params['partial_amount_to_pay']) ) { - $partialAmtPay = CRM_Utils_Rule::cleanMoney($params['partial_amount_pay']); + $partialAmtPay = CRM_Utils_Rule::cleanMoney($params['partial_amount_to_pay']); $partialAmtTotal = CRM_Utils_Rule::cleanMoney($params['partial_payment_total']); $fromFinancialAccountId = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($params['financial_type_id'], 'Accounts Receivable Account is'); @@ -3450,7 +3450,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac $trxnParams['card_type_id'] = CRM_Utils_Array::value('card_type_id', $params); $return = $financialTxn = CRM_Core_BAO_FinancialTrxn::create($trxnParams); $params['entity_id'] = $financialTxn->id; - if (empty($params['partial_payment_total']) && empty($params['partial_amount_pay'])) { + if (empty($params['partial_payment_total']) && empty($params['partial_amount_to_pay'])) { self::$_trxnIDs[] = $financialTxn->id; } } @@ -3852,7 +3852,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac $arAccountId = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($contributionDAO->financial_type_id, 'Accounts Receivable Account is'); if ($paymentType == 'owed') { $params['partial_payment_total'] = $contributionDAO->total_amount; - $params['partial_amount_pay'] = $trxnsData['total_amount']; + $params['partial_amount_to_pay'] = $trxnsData['total_amount']; $trxnsData['net_amount'] = !empty($trxnsData['net_amount']) ? $trxnsData['net_amount'] : $trxnsData['total_amount']; $params['pan_truncation'] = CRM_Utils_Array::value('pan_truncation', $trxnsData); $params['card_type_id'] = CRM_Utils_Array::value('card_type_id', $trxnsData); diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index f04b0cc81e..c524956793 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -1399,7 +1399,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment // the owed amount $contributionParams['partial_payment_total'] = $amountOwed; // the actual amount paid - $contributionParams['partial_amount_pay'] = $params['total_amount']; + $contributionParams['partial_amount_to_pay'] = $params['total_amount']; } } @@ -1550,7 +1550,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment $this->assign('totalAmount', $contributionParams['total_amount']); if (isset($contributionParams['partial_payment_total'])) { // balance amount - $balanceAmount = $contributionParams['partial_payment_total'] - $contributionParams['partial_amount_pay']; + $balanceAmount = $contributionParams['partial_payment_total'] - $contributionParams['partial_amount_to_pay']; $this->assign('balanceAmount', $balanceAmount); } $this->assign('isPrimary', 1); diff --git a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php index c2ca619c11..a39b1d306e 100644 --- a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php @@ -690,7 +690,7 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2"; 'financial_type_id' => 4, 'contribution_status_id' => 1, 'partial_payment_total' => 300.00, - 'partial_amount_pay' => 150, + 'partial_amount_to_pay' => 150, 'contribution_mode' => 'participant', 'participant_id' => $participant->id, ); @@ -1017,7 +1017,7 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2"; 'receipt_date' => '20080522000000', 'total_amount' => '20000.00', 'partial_payment_total' => '20,000.00', - 'partial_amount_pay' => '8,000.00', + 'partial_amount_to_pay' => '8,000.00', ); $contribution = CRM_Contribute_BAO_Contribution::create($params); diff --git a/tests/phpunit/CRM/Contribute/Form/AdditionalPaymentTest.php b/tests/phpunit/CRM/Contribute/Form/AdditionalPaymentTest.php index 07055bf7bb..779e60cf71 100644 --- a/tests/phpunit/CRM/Contribute/Form/AdditionalPaymentTest.php +++ b/tests/phpunit/CRM/Contribute/Form/AdditionalPaymentTest.php @@ -262,7 +262,7 @@ class CRM_Contribute_Form_AdditionalPaymentTest extends CiviUnitTestCase { if ($typeofContribution == 'Partially paid') { $contributionParams = array_merge($this->_params, array( 'partial_payment_total' => 100.00, - 'partial_amount_pay' => 30, + 'partial_amount_to_pay' => 30, 'contribution_status_id' => 1, )); } diff --git a/tests/phpunit/CRM/Event/BAO/AdditionalPaymentTest.php b/tests/phpunit/CRM/Event/BAO/AdditionalPaymentTest.php index d22cf982cb..f0b3663934 100644 --- a/tests/phpunit/CRM/Event/BAO/AdditionalPaymentTest.php +++ b/tests/phpunit/CRM/Event/BAO/AdditionalPaymentTest.php @@ -100,7 +100,7 @@ class CRM_Event_BAO_AdditionalPaymentTest extends CiviUnitTestCase { 'receive_date' => date('Y-m-d') . " 00:00:00", 'skipLineItem' => 1, 'partial_payment_total' => $feeTotal, - 'partial_amount_pay' => $actualPaidAmt, + 'partial_amount_to_pay' => $actualPaidAmt, ); $contribution = CRM_Contribute_BAO_Contribution::create($contributionParams); diff --git a/tests/phpunit/CRM/Event/BAO/CRM19273Test.php b/tests/phpunit/CRM/Event/BAO/CRM19273Test.php index 0b04ba580a..d73aa874b2 100644 --- a/tests/phpunit/CRM/Event/BAO/CRM19273Test.php +++ b/tests/phpunit/CRM/Event/BAO/CRM19273Test.php @@ -204,7 +204,7 @@ class CRM_Event_BAO_CRM19273 extends CiviUnitTestCase { 'receive_date' => date('Y-m-d') . " 00:00:00", 'skipLineItem' => 1, 'partial_payment_total' => $this->_expensiveFee, - 'partial_amount_pay' => $actualPaidAmt, + 'partial_amount_to_pay' => $actualPaidAmt, ); $contribution = CRM_Contribute_BAO_Contribution::create($contributionParams); diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index fd00e44982..9c98bd24fd 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -3394,7 +3394,7 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' ) 'financial_type_id' => 4, 'contribution_status_id' => 1, 'partial_payment_total' => 300.00, - 'partial_amount_pay' => 150, + 'partial_amount_to_pay' => 150, 'contribution_mode' => 'participant', 'participant_id' => $participant['id'], ); -- 2.25.1