From: eileen Date: Mon, 11 Feb 2019 04:33:47 +0000 (+1300) Subject: Replace call to silly confusing function with simple function. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=abafc4c430d6af57cac5a503d3d5fd8a150e25b8;p=civicrm-core.git Replace call to silly confusing function with simple function. If you dig down into CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType you find that just calling CRM_Contribute_BAO_Contribution::getContributionBalance is all it actually does here.... --- diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 88ef2e8718..ff359e3ba3 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -4002,8 +4002,6 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) */ public static function getPaymentInfo($id, $component, $getTrxnInfo = FALSE, $usingLineTotal = FALSE) { if ($component == 'event') { - $entity = 'participant'; - $entityTable = 'civicrm_participant'; $contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_ParticipantPayment', $id, 'contribution_id', 'participant_id'); if (!$contributionId) { @@ -4017,14 +4015,10 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) } } elseif ($component == 'membership') { - $entity = $component; - $entityTable = 'civicrm_membership'; $contributionId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipPayment', $id, 'contribution_id', 'membership_id'); } else { $contributionId = $id; - $entity = 'contribution'; - $entityTable = 'civicrm_contribution'; } $total = CRM_Core_BAO_FinancialTrxn::getBalanceTrxnAmt($contributionId); @@ -4041,7 +4035,8 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) $total = $total['total_amount']; } - $paymentBalance = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType($id, $entity, FALSE, $total); + $paymentBalance = CRM_Contribute_BAO_Contribution::getContributionBalance($contributionId, $total); + $contribution = civicrm_api3('Contribution', 'getsingle', array('id' => $contributionId, 'return' => array('currency', 'is_pay_later', 'contribution_status_id', 'financial_type_id'))); $info['payLater'] = $contribution['is_pay_later'];