Body: <p>Drupal 9.2.6
  CiviCRM 5.41.2</p>
  <p>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:</p>
  <pre><code>TypeError: Return value of CRM_Financial_BAO_Order::getDefaultPriceFieldID() must be of the type int, null returned in CRM_Financial_BAO_Order-&gt;getDefaultPriceFieldID() (line 671 of /home/XXXX/www/www/vendor/civicrm/civicrm-core/CRM/Financial/BAO/Order.php)
  </code></pre>
  <p>and</p>
  <pre><code>Notice: Trying to access array offset on value of type null in CRM_Financial_BAO_Order-&gt;getDefaultPriceFieldID() (line 671 of /home/XXXX/www/www/vendor/civicrm/civicrm-core/CRM/Financial/BAO/Order.php) 
  </code></pre>
  <p>When I imported the data, I filled the following tables (not in this order, necessarily):</p>
  <ul>
  <li>civicrm_contributions</li>
  <li>civicrm_line_item</li>
  <li>civicrm_price_field</li>
  <li>civicrm_price_field_value</li>
  <li>civicrm_price_set</li>
  <li>civicrm_entity_financial_trxn</li>
  <li>civicrm_financial_item</li>
  <li>civicrm_financial_trxn</li>
  </ul>
  <p>I've seen a <a href="https://civicrm.stackexchange.com/questions/40380/cannot-connect-to-server-error-after-civi-update-to-5-41-0">similar question</a> 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.</p>
  <p>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?</p>
  <p>I'm really stuck with this one! Any help would be much appreciated :)</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-09-30T17:14:53.390Z
Comments.Text: 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.
Comments.UserDisplayName: KarinG - Semper IT
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-09-30T20:16:44.497Z
Comments.Text: maybe too late but did you consider using https://civicrm.org/extensions/api-csv-import-gui
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-03T16:29:44.100Z
Comments.Text: 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...
Comments.UserDisplayName: Rose Lanigan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-03T17:24:45.467Z
Comments.Text: 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.
Comments.UserDisplayName: Rose Lanigan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-04T09:35:32.173Z
Comments.Text: 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 https://lab.civicrm.org/dev/core/-/blob/master/CRM/Financial/BAO/Order.php#L664 for the expected entities.
Comments.UserDisplayName: artfulrobot
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-04T16:42:27.037Z
Comments.Text: Hi Rich! I did look through this code and the only place I can see the option to specify if something is default is in the table civicrm_price_field_value. I've set them all to 1 - is that wrong? I have one row for each unique payment amount (this site relies heavily on donations, so this table has 550 rows for 16k+ contributions).
Comments.UserDisplayName: Rose Lanigan
Tags: <civicontribute><import>
Title: Can't save new or existing contributions after import (Drupal 9, CiviCRM 5.41)
ThreadText: # Can't save new or existing contributions after import (Drupal 9, CiviCRM 5.41)
  
  (Asked by: username_0 on 2021-09-30)
  
  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)
  
  ```
  
  and
  
  ```
  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](https://civicrm.stackexchange.com/questions/40380/cannot-connect-to-server-error-after-civi-update-to-5-41-0) 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 :)
  
  **Tags:** civicontribute, import
  
  > **Comments:**
  > **username_1**: Hi username_0 - 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.  
  > **username_2**: maybe too late but did you consider using https://civicrm.org/extensions/api-csv-import-gui  
  > **username_0**: 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...  
  > **username_0**: 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.  
  > **username_3**: Hey username_0  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 https://lab.civicrm.org/dev/core/-/blob/master/CRM/Financial/BAO/Order.php#L664 for the expected entities.  
  > **username_0**: Hi Rich! I did look through this code and the only place I can see the option to specify if something is default is in the table civicrm_price_field_value. I've set them all to 1 - is that wrong? I have one row for each unique payment amount (this site relies heavily on donations, so this table has 550 rows for 16k+ contributions).  
  
  ---
  
  ## 0 answers
  
  