3

When I add in a manual contribution against a contact and specify an amount - when submitting, the amount gets registered as 0 which is not what was input initially. In the database it is seen as 0 also.

The warnings/errors that comes up are:

Warning: key() expects parameter 1 to be array, null given in CRM_Contribute_Form_Contribution->submit() (line 1461 of /home/xxx/www/www/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution.php).
Warning: key() expects parameter 1 to be array, null given in CRM_Contribute_Form_Contribution->submit() (line 1462 of /home/xxx/www/www/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution.php).
Notice: Undefined index: html_type in CRM_Price_BAO_PriceSet::processAmount() (line 718 of /home/xxxx/www/www/sites/all/modules/civicrm/CRM/Price/BAO/PriceSet.php).

and the error in the log is:

TYPE    php
DATE    Thursday, May 25, 2017 - 20:26
USER    admin
LOCATION    civicrm/contribute/add
REFERRER    civicrm/contribute/add?reset=1&action=add&context=standalone
MESSAGE Notice: Undefined index: html_type in CRM_Price_BAO_PriceSet::processAmount() (line 718 of /home/xxxx/www/www/sites/all/modules/civicrm/CRM/Price/BAO/PriceSet.php).
SEVERITY    notice
HOSTNAME    xxx.xxx
OPERATIONS

This site was upgraded from previous versions to CiviCRM version 4.7.19 and there were some problems with the old database. There was an " Invalid Price Fields " message with regards to the 'Contribution Amount' price set which we couldn't fix, so we just hid that message.

Any help would be much appreciated.

Edit 1: Just to note, however, that adding by selecting a price set works. Its just the manual input for amount.

Edit 2: just to let you know that some price fields were disabled so I enabled them and it all worked!

  • Can you reproduce this on one of the demo sites? civicrm.org/demo – Aidan May 25 '17 at 18:11
  • I can't replicate but not sure what is going wrong my side as I have a already huge CiviCRM DB that Hershel imported to a fresh copy of CiviCRM & Drupal. – Sovereign108 May 25 '17 at 19:20
  • can you spell out exactly how you are adding the 'manual contribution' since the are in theory a number of ways this could be achieved – petednz - fuzion May 25 '17 at 20:28
  • I login as admin, go to CiviCRM > Contributions > New Contributions and fill in the details. Thats all really. – Sovereign108 May 25 '17 at 20:31
  • Do you have any extensions enabled? If so, disable those and see if the problem continues. – Aidan May 25 '17 at 20:40
1

This problem arises when the default price set, or any of its fields, are inactive

It took a lot of digging to find this, but if you enter a contribution with no price set, it looks up the default price set and runs some code against that, which fails under these conditions, and causes the total price to be set to 0.

Assuming that the default price set is the one with id 1 (as it is on my system), running this sql will fix the problem:

update civicrm_price_field set is_active = 1 where price_set_id = 1;
update civicrm_price_set set is_active = 1 where id = 1;

This is the sql that runs and must return something - test it, and if it doesn't, make the required changes:

mysql> SELECT id,name,label,html_type,is_enter_qty,help_pre,help_post,weight,is_display_amounts,options_per_line,is_active,active_on,expire_on,javascript,visibility_id,is_required,is_required FROM civicrm_price_field WHERE price_set_id = 1 ORDER BY weight;

If this does not work then perhaps your default price set has a different id; I don't know how to check this except to put an error_log statement around line 1470 of CRM/Contribute/Form/Contribution.php to log the value of $priceSetId

  • Executing update queries solves 0 price value for me but Invalid Price Fields message on system status page persists. Some advice to solve it? – Francesc Bassas i Bullich Jul 28 '17 at 8:46
0

Since you had related problems before the upgrade it sounds like there is something wrong within the database. There is a procedure for Ensuring Schema Integrity on Upgrades that you could try to repair the schema. Don't be too put off by the references to 2.2.x - I used it a while back, probably on a 4.6 system.

  • I believe Hershel did all that I'm afraid! I could try to do it again as I have no idea what else to try. – Sovereign108 May 25 '17 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.