From 3256b416f7bcdfaba5ce3e612d621251d9cd9012 Mon Sep 17 00:00:00 2001 From: Jamie McClelland Date: Mon, 18 Aug 2014 11:09:52 -0400 Subject: [PATCH] CRM-14930 - fix underlying data problem with authnet net_amount Revert "CRM-14881 - avoid error when saving contribution made by authnet" This reverts commit b29eb7605df438ab222f1f741d220b145da2f059. Conflicts: CRM/Contribute/Form/Contribution.php Reverting in favor of a solution that solves the underlying data problem, rather than a solution that works around a data problem. The original issue is: https://issues.civicrm.org/jira/browse/CRM-14881 This revert is: https://issues.civicrm.org/jira/browse/CRM-14930 --- CRM/Contribute/Form/Contribution.php | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index cfefe62ec1..0343353378 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -953,23 +953,9 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $softErrors = CRM_Contribute_Form_SoftCredit::formRule($fields, $errors, $self); - // If we have a net amount or fee amount that is NOT set to 0.00, then ensure - // that the net_amount + the fee_amount is equal to the total amount. - $total_amount = NULL; - if(!empty($fields['total_amount']) && $fields['total_amount'] != '0.00') { - $total_amount = $fields['total_amount']; - } - $fee_amount = NULL; - if(!empty($fields['fee_amount']) && $fields['fee_amount'] != '0.00') { - $fee_amount = $fields['fee_amount']; - } - $net_amount = NULL; - if(!empty($fields['net_amount']) && $fields['net_amount'] != '0.00') { - $net_amount = $fields['net_amount']; - } - if ($total_amount && ($net_amount || $fee_amount)) { - $sum = CRM_Utils_Rule::cleanMoney($net_amount) + CRM_Utils_Rule::cleanMoney($fee_amount); - if (CRM_Utils_Rule::cleanMoney($total_amount) != $sum) { + if (!empty($fields['total_amount']) && (!empty($fields['net_amount']) || !empty($fields['fee_amount']))) { + $sum = CRM_Utils_Rule::cleanMoney($fields['net_amount']) + CRM_Utils_Rule::cleanMoney($fields['fee_amount']); + if (CRM_Utils_Rule::cleanMoney($fields['total_amount']) != $sum) { $errors['total_amount'] = ts('The sum of fee amount and net amount must be equal to total amount'); } } -- 2.25.1