From 8c52df67e8d210ddac43c8f88d6aed4034935f37 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 30 Oct 2015 13:50:35 -0600 Subject: [PATCH] CRM-17469 - add amount attribute to pledge block check boxes --- CRM/Pledge/BAO/PledgeBlock.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CRM/Pledge/BAO/PledgeBlock.php b/CRM/Pledge/BAO/PledgeBlock.php index 06b4d98367..50a51566a0 100644 --- a/CRM/Pledge/BAO/PledgeBlock.php +++ b/CRM/Pledge/BAO/PledgeBlock.php @@ -212,7 +212,6 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { $nextPayment = array(); $isNextPayment = FALSE; $overduePayments = array(); - $now = date('Ymd'); foreach ($allPayments as $payID => $value) { if ($allStatus[$value['status_id']] == 'Overdue') { $overduePayments[$payID] = array( @@ -244,20 +243,22 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { $payments = array(); if (!empty($overduePayments)) { foreach ($overduePayments as $id => $payment) { - $key = ts("%1 - due on %2 (overdue)", array( + $label = ts("%1 - due on %2 (overdue)", array( 1 => CRM_Utils_Money::format(CRM_Utils_Array::value('scheduled_amount', $payment), CRM_Utils_Array::value('scheduled_amount_currency', $payment)), 2 => CRM_Utils_Array::value('scheduled_date', $payment), )); - $payments[$key] = CRM_Utils_Array::value('id', $payment); + $paymentID = CRM_Utils_Array::value('id', $payment); + $payments[] = $form->createElement('checkbox', $paymentID, NULL, $label, array('amount' => CRM_Utils_Array::value('scheduled_amount', $payment))); } } if (!empty($nextPayment)) { - $key = ts("%1 - due on %2", array( + $label = ts("%1 - due on %2", array( 1 => CRM_Utils_Money::format(CRM_Utils_Array::value('scheduled_amount', $nextPayment), CRM_Utils_Array::value('scheduled_amount_currency', $nextPayment)), 2 => CRM_Utils_Array::value('scheduled_date', $nextPayment), )); - $payments[$key] = CRM_Utils_Array::value('id', $nextPayment); + $paymentID = CRM_Utils_Array::value('id', $nextPayment); + $payments[] = $form->createElement('checkbox', $paymentID, NULL, $label, array('amount' => CRM_Utils_Array::value('scheduled_amount', $nextPayment))); } // give error if empty or build form for payment. if (empty($payments)) { @@ -265,7 +266,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { } else { $form->assign('is_pledge_payment', TRUE); - $form->addCheckBox('pledge_amount', ts('Make Pledge Payment(s):'), $payments); + $form->addGroup($payments, 'pledge_amount', ts('Make Pledge Payment(s):'), '
'); } } else { -- 2.25.1