From 356579e948aa6c4d4df593e3c5b0fd4a33beb89b Mon Sep 17 00:00:00 2001 From: Pratik Joshi Date: Mon, 21 Apr 2014 19:56:58 +0530 Subject: [PATCH] CRM-13973-comment : pay later for additional participants --- CRM/Contribute/BAO/Contribution.php | 6 ++++++ CRM/Event/Form/Participant.php | 8 ++++++++ templates/CRM/Contribute/Page/PaymentInfo.tpl | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 30c2ba466c..3418350d8e 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -3207,11 +3207,17 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) } $paymentBalance = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType($id, $entity, FALSE, $total); + $contributionIsPayLater = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contributionId, 'is_pay_later'); + if ($paymentBalance == 0 && $contributionIsPayLater) { + $paymentBalance = $total; + } + $info['total'] = $total; $info['paid'] = $total - $paymentBalance; $info['balance'] = $paymentBalance; $info['id'] = $id; $info['component'] = $component; + $info['payLater'] = $contributionIsPayLater; $rows = array(); if ($getTrxnInfo && $baseTrxnId) { $sql = " diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 22549f0763..6e1f24c366 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -1415,6 +1415,14 @@ SELECT civicrm_custom_group.name as name, $amountOwed = $params['fee_amount']; } + // if multiple participants are link, consider contribution total amount as the amount Owed + if (CRM_Event_BAO_Participant::isPrimaryParticipant($this->_id)) { + $amountOwed = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', + $ids['contribution'], + 'total_amount' + ); + } + // CRM-13964 partial_payment_total if ($amountOwed > $params['total_amount']) { // the owed amount diff --git a/templates/CRM/Contribute/Page/PaymentInfo.tpl b/templates/CRM/Contribute/Page/PaymentInfo.tpl index 64bb4ec418..812233877a 100644 --- a/templates/CRM/Contribute/Page/PaymentInfo.tpl +++ b/templates/CRM/Contribute/Page/PaymentInfo.tpl @@ -63,7 +63,7 @@ CRM.$(function($) { {$paymentInfo.balance|crmMoney} -{if $paymentInfo.balance} +{if $paymentInfo.balance and !$paymentInfo.payLater} {if $paymentInfo.balance > 0} {assign var=paymentButtonName value='Record Payment'} {elseif $paymentInfo.balance < 0} -- 2.25.1