Crash when viewing contact's contribution tab and a contribution has no line items
Contributions are supposed to all have line items, but this isn't universally true - in particular, it seems like imported contributions don't all have them. This caused no issues until Civi 5.53, specifically PR #24142.
Steps to replicate
- Manually delete (in the db) the line item for the "template" contribution for a recurring contribution. I thought that this would be the first contribution in the series, but apparently it's the most recent.
- Attempt to view the contact's contribution tab containing that contribution
Expected Result
View the contribution tab normally.
Actual Result
PHP Fatal error: Uncaught TypeError: CRM_Financial_BAO_Order::setPriceSetID(): Argument #1 ($priceSetID) must be of type int, null given, called in /home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Financial/BAO/Order.php on line 841 and defined in /home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Financial/BAO/Order.php:472"