Drupal 9.2.6 CiviCRM 5.41.2

I imported some contributions via the SQL database (there's 16k+ so I don't want to use the UI) but I cannot edit or add a contribution. The triangle just spins, and there are two similar errors appearing in the logs:

TypeError: Return value of CRM_Financial_BAO_Order::getDefaultPriceFieldID() must be of the type int, null returned in CRM_Financial_BAO_Order->getDefaultPriceFieldID() (line 671 of /home/XXXX/www/www/vendor/civicrm/civicrm-core/CRM/Financial/BAO/Order.php)


Notice: Trying to access array offset on value of type null in CRM_Financial_BAO_Order->getDefaultPriceFieldID() (line 671 of /home/XXXX/www/www/vendor/civicrm/civicrm-core/CRM/Financial/BAO/Order.php) 

When I imported the data, I filled the following tables (not in this order, necessarily):

  • civicrm_contributions
  • civicrm_line_item
  • civicrm_price_field
  • civicrm_price_field_value
  • civicrm_price_set
  • civicrm_entity_financial_trxn
  • civicrm_financial_item
  • civicrm_financial_trxn

I've seen a similar question recently with the same sort of error code but the solution doesn't help (none of the rows in the line_item table have NULL for either price_field or price_field_value) and I've disabled the webform to verify that it's not related to that.

Is there anywhere else I should've imported data, or anywhere else in the tables where I should be checking the price_field/price_field_value?

I'm really stuck with this one! Any help would be much appreciated :)

  • Hi Rose - so this tells me both contributions generated with the API (that’s what webform civicrm does) as well as contributions imported via SQL import - in CiviCRM 5.41 have issues when trying to View such Contributions. Sep 30, 2021 at 17:14
  • maybe too late but did you consider using civicrm.org/extensions/api-csv-import-gui
    – petednz - fuzion
    Sep 30, 2021 at 20:16
  • I removed all the imported contributions (and associated information) as well as any custom settings or extensions that were related to contributions, and I'm still getting the same error. I don't think it's the version because I have another site that was set up around the same time, set up on the same version of Drupal, and that is working fine. The only difference between the two sites was the imported contributiosn (or so I thought) but even when I remove them, I've getting the error! I'm still troubleshooting... Oct 3, 2021 at 16:29
  • One thing I've noticed is the Subject field in the Activity table picks up £0.00 for the Subject field. If I try to overwrite this with the correct amount (using the import), it blanks it out during the import. This seems unrelated but it's the only thing I've come across so far that behaved differently/incorrectly. Oct 3, 2021 at 17:24
  • Hey Rose 👋 It's complaining about a lack of a default pricefield - you couldn't have accidentally deleted/overwritten it by your imports (or more likely, by a cleanup)? See lab.civicrm.org/dev/core/-/blob/master/CRM/Financial/BAO/… for the expected entities. Oct 4, 2021 at 9:35


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.