CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • When editing a contribution: error about fee + net not equal total
Pages: [1]

Author Topic: When editing a contribution: error about fee + net not equal total  (Read 463 times)

jamie

  • I post occasionally
  • **
  • Posts: 95
  • Karma: 6
When editing a contribution: error about fee + net not equal total
March 11, 2014, 02:10:00 pm
The full error is:

The sum of fee amount and net amount must be equal to total amount

It seems to be caused by net_amount and fee_amount being set to '0.00' instead of NULL.

The check is only supposed to be made if either net_amount or fee_amount is set:

Code: [Select]
if (CRM_Utils_Array::value('total_amount', $fields) && (CRM_Utils_Array::value('net_amount', $fields) || CRM_Utils_Array::value('fee_amount', $fields))) {
 ...

If I update the database, changing net_amount and fee_amount to NULL, it works. Similarly, if I change the code to be:

Code: [Select]
$fee_amount = CRM_Utils_Array::value('fee_amount', $fields);
$net_amount = CRM_Utils_Array::value('net_amount', $fields);
if (CRM_Utils_Array::value('total_amount', $fields)) {
      if(($fee_amount && $fee_amount != '0.00') || ($net_amount && $net_amount != '0.00')) {

It also works.

Is the data bad? Or should the code be changed?

jamie

  • I post occasionally
  • **
  • Posts: 95
  • Karma: 6
Re: When editing a contribution: error about fee + net not equal total
June 30, 2014, 10:37:00 am
There's a JIRA issue here: https://issues.civicrm.org/jira/browse/CRM-14881 which should get included soon.

I went with fixing the code rather than the (existing) data.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • When editing a contribution: error about fee + net not equal total

This forum was archived on 2017-11-26.