Answers.Body: <p>This problem arises when the default price set, or any of its fields, are inactive</p>
  
  <p>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.</p>
  
  <p>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:</p>
  
  <pre><code>update civicrm_price_field set is_active = 1 where price_set_id = 1;
  update civicrm_price_set set is_active = 1 where id = 1;
  </code></pre>
  
  <p>This is the sql that runs and must return something - test it, and if it doesn't, make the required changes:</p>
  
  <pre><code>mysql&gt; 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;
  </code></pre>
  
  <p>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</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-28T08:46:40.217Z
Answers.Text: Executing update queries solves 0 price value for me but Invalid Price Fields message on system status page persists. Some advice to solve it?
Answers.UserDisplayName: Francesc Bassas i Bullich
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-01T14:04:50.567Z
Answers.LastActivityDate: 2017-06-01T14:04:50.567Z
Answers.UserDisplayName: naomi
Answers.Body: <p>Since you had related problems before the upgrade it sounds like there is something wrong within the database.  There is a procedure for <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Ensuring+Schema+Integrity+on+Upgrades" rel="nofollow noreferrer">Ensuring Schema Integrity on Upgrades</a> 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.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-25T20:53:10.550Z
Answers.Text: 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.
Answers.UserDisplayName: Sovereign108
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-25T20:50:09.763Z
Answers.LastActivityDate: 2017-05-25T20:50:09.763Z
Answers.UserDisplayName: Aidan
Body: <p>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.</p>
  
  <p>The warnings/errors that comes up are:</p>
  
  <pre><code>Warning: key() expects parameter 1 to be array, null given in CRM_Contribute_Form_Contribution-&gt;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-&gt;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).
  </code></pre>
  
  <p>and the error in the log is:</p>
  
  <pre><code>TYPE    php
  DATE    Thursday, May 25, 2017 - 20:26
  USER    admin
  LOCATION    civicrm/contribute/add
  REFERRER    civicrm/contribute/add?reset=1&amp;action=add&amp;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
  </code></pre>
  
  <p>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.</p>
  
  <p>Any help would be much appreciated.</p>
  
  <p>Edit 1: 
  Just to note, however, that adding by selecting a price set works. Its just the manual input for amount.</p>
  
  <p>Edit 2: just to let you know that some price fields were disabled so I enabled them and it all worked!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-25T18:11:29.010Z
Comments.Text: Can you reproduce this on one of the demo sites?  https://civicrm.org/demo
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-25T19:20:25.303Z
Comments.Text: 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.
Comments.UserDisplayName: Sovereign108
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-25T20:28:22.057Z
Comments.Text: 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
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-25T20:31:12.023Z
Comments.Text: I login as admin, go to CiviCRM > Contributions > New Contributions and fill in the details. Thats all really.
Comments.UserDisplayName: Sovereign108
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-25T20:40:14.277Z
Comments.Text: Do you have any extensions enabled?  If so, disable those and see if the problem continues.
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-25T20:41:00.493Z
Comments.Text: Thats exactly the thing I did recently - disabled all extensions in CiviCRM but that does nothing. Rather perplexed.
Comments.UserDisplayName: Sovereign108
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-25T21:52:42.830Z
Comments.Text: The errors in question are specifically dealing with price sets.  I would fix that price set issue.
Comments.UserDisplayName: Jon G - Megaphone Tech
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-26T05:51:05.790Z
Comments.Text: Price sets? Even if it's manual input of the amount?
Comments.UserDisplayName: Sovereign108
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-26T06:22:13.337Z
Comments.Text: I did go through the price sets but not really sure what I am looking for as it all looks OK to me.
Comments.UserDisplayName: Sovereign108
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-15T04:25:09.033Z
Comments.Text: Had a similar problem just now, so answering this similar problem in case someone googles this page as I did.
Comments.UserDisplayName: Moocows
Tags: <civicontribute>
Title: Manual Contributions Showing up as 0 Against Contact
ThreadText: # Manual Contributions Showing up as 0 Against Contact
  
  (Asked by: username_0 on 2017-05-25)
  
  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!
  
  **Tags:** civicontribute
  
  > **Comments:**
  > **username_1**: Can you reproduce this on one of the demo sites?  https://civicrm.org/demo  
  > **username_0**: 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.  
  > **username_2**: 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  
  > **username_0**: I login as admin, go to CiviCRM > Contributions > New Contributions and fill in the details. Thats all really.  
  > **username_1**: Do you have any extensions enabled?  If so, disable those and see if the problem continues.  
  > **username_0**: Thats exactly the thing I did recently - disabled all extensions in CiviCRM but that does nothing. Rather perplexed.  
  > **username_3**: The errors in question are specifically dealing with price sets.  I would fix that price set issue.  
  > **username_0**: Price sets? Even if it's manual input of the amount?  
  > **username_0**: I did go through the price sets but not really sure what I am looking for as it all looks OK to me.  
  > **username_4**: Had a similar problem just now, so answering this similar problem in case someone googles this page as I did.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_5 on 2017-06-01. Score: 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
  
  > **Comments:**
  > **username_6**: Executing update queries solves 0 price value for me but Invalid Price Fields message on system status page persists. Some advice to solve it?  
  
  ---
  
  ### Answer by username_1 on 2017-05-25. Score: 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](https://wiki.civicrm.org/confluence/display/CRMDOC/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.
  
  > **Comments:**
  > **username_0**: 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.  
  
  ---
  
  