From 36f46ce739bc5eab0ec721554e2c87a25d1630d9 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 15 Aug 2017 15:42:00 -0400 Subject: [PATCH] Cleanup for CRM-17821. Minor tidy ups to help me read the code --- CRM/Pledge/BAO/PledgePayment.php | 8 +++----- tests/phpunit/CRM/Pledge/BAO/PledgePaymentTest.php | 3 +-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/CRM/Pledge/BAO/PledgePayment.php b/CRM/Pledge/BAO/PledgePayment.php index 1e625bbe7e..18fe2ce7a0 100644 --- a/CRM/Pledge/BAO/PledgePayment.php +++ b/CRM/Pledge/BAO/PledgePayment.php @@ -688,10 +688,7 @@ WHERE civicrm_pledge_payment.pledge_id = %1 {$paymentClause} "; - // get all status - $params = array(1 => array($pledgeId, 'Integer')); - - $dao = CRM_Core_DAO::executeQuery($query, $params); + CRM_Core_DAO::executeQuery($query, array(1 => array($pledgeId, 'Integer'))); } /** @@ -772,7 +769,8 @@ LIMIT 0, %2 */ public static function adjustPledgePayment($pledgeID, $actualAmount, $pledgeScheduledAmount, $paymentContributionId = NULL, $pPaymentId = NULL, $paymentStatusID = NULL) { $allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); - if ($paymentStatusID == array_search('Cancelled', $allStatus) || $paymentStatusID == array_search('Refunded', $allStatus)) { + $paymentStatusName = CRM_Core_PseudoConstant::getName('CRM_Pledge_BAO_PledgePayment', 'status_id', $paymentStatusID); + if ($paymentStatusName == 'Cancelled'|| $paymentStatusName == 'Refunded') { $query = " SELECT civicrm_pledge_payment.id id FROM civicrm_pledge_payment diff --git a/tests/phpunit/CRM/Pledge/BAO/PledgePaymentTest.php b/tests/phpunit/CRM/Pledge/BAO/PledgePaymentTest.php index eab1324c5b..a14ee023a6 100644 --- a/tests/phpunit/CRM/Pledge/BAO/PledgePaymentTest.php +++ b/tests/phpunit/CRM/Pledge/BAO/PledgePaymentTest.php @@ -466,8 +466,7 @@ class CRM_Pledge_BAO_PledgePaymentTest extends CiviUnitTestCase { 'trxn_id' => 47, 'total_amount' => 100.00, 'fee_amount' => 0.00, - 'net_ammount' => 100.00, - 'financial_type_id' => 1, + 'net_amount' => 100.00, 'payment_instrument_id' => 1, 'non_deductible_amount' => 0.00, )); -- 2.25.1