Skip to content

Commit c20ea27

Browse files
authoredSep 21, 2023
Merge pull request #25 from kurund/fatal-error-fixes
fatal error fixes when amount is greater than 1000 and extra fee is checked
2 parents 205783d + cdfd60c commit c20ea27

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎CRM/Extrafee/Fee.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,20 @@ public static function modifyTotalAmountInParams($formName, &$form, $extraFeeSet
6464
if ($formName == 'CRM_Contribute_Form_Contribution_Main') {
6565
if (!empty($form->_amount)) {
6666
$form->_amount += $form->_amount * $percent/100 + $processingFee;
67-
$form->_amount = number_format($form->_amount, 2);
67+
$form->_amount = round(CRM_Utils_Rule::cleanMoney($form->_amount), 2);
6868
$form->set('amount', $form->_amount);
6969
}
7070
elseif ($amt = $form->get('amount')) {
7171
$form->_amount = $amt + $amt * $percent/100 + $processingFee;
72-
$form->_amount = number_format($form->_amount, 2);
72+
$form->_amount = round(CRM_Utils_Rule::cleanMoney($form->_amount), 2);
7373
$form->set('amount', $form->_amount);
7474
}
7575
}
7676
elseif ($formName == 'CRM_Event_Form_Registration_Register') {
7777
$params = $form->getVar('_params');
7878
if (!empty($params[0]['amount'])) {
7979
$params[0]['amount'] += $params[0]['amount'] * $percent/100 + $processingFee;
80-
$params[0]['amount'] = number_format($params[0]['amount'], 2);
80+
$params[0]['amount'] = round(CRM_Utils_Rule::cleanMoney($params[0]['amount']), 2);
8181
$form->setVar('_params', $params);
8282
$form->set('params', $params);
8383
}

0 commit comments

Comments
 (0)
Please sign in to comment.