<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
for ($rowNumber = 1; $rowNumber <= $item_count; $rowNumber++) {
CRM_Contact_Form_NewContact::buildQuickForm($form, $rowNumber, NULL, FALSE, $prefix);
- $form->addMoney("{$prefix}amount[{$rowNumber}]", ts('Amount'));
+ $form->addMoney("{$prefix}amount[{$rowNumber}]", ts('Amount'), FALSE, NULL, FALSE);
if (!empty($form->_softCreditInfo['soft_credit'][$rowNumber]['soft_credit_id'])) {
$form->add('hidden', "{$prefix}id[{$rowNumber}]",
$form->_softCreditInfo['soft_credit'][$rowNumber]['soft_credit_id']);
static function setDefaultValues(&$defaults, &$form) {
if (!empty($form->_softCreditInfo['soft_credit'])) {
foreach ($form->_softCreditInfo['soft_credit'] as $key => $value) {
- $defaults["soft_credit_amount[$key]"] = $value['amount'];
+ $defaults["soft_credit_amount[$key]"] = CRM_Utils_Money::format($value['amount'], NULL, '%a');
$defaults["soft_credit_contact_select_id[$key]"] = $value['contact_id'];
}
}
if ($repeat[$fields['soft_credit_contact_select_id'][$key]] > 1) {
$errors["soft_credit_contact_select_id[$key]"] = ts('You cannot enter multiple soft credits for the same contact.');
}
- if ($fields['soft_credit_amount'][$key] && ($fields['soft_credit_amount'][$key] > $fields['total_amount'])) {
+ if ($fields['soft_credit_amount'][$key]
+ && (CRM_Utils_Rule::cleanMoney($fields['soft_credit_amount'][$key]) > CRM_Utils_Rule::cleanMoney($fields['total_amount']))) {
$errors["soft_credit_amount[$key]"] = ts('Soft credit amount cannot be more than the total amount.');
}
if (empty($fields['soft_credit_amount'][$key])) {