From 1067779b0214d47d4f8d6c863188ebb4337a6568 Mon Sep 17 00:00:00 2001 From: Jon Goldberg Date: Fri, 9 Dec 2022 12:50:57 -0500 Subject: [PATCH] fixes core#4027 - don't crash when a contribution has no line items --- CRM/Financial/BAO/Order.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CRM/Financial/BAO/Order.php b/CRM/Financial/BAO/Order.php index a2ae54e8c3..f1ed6c04da 100644 --- a/CRM/Financial/BAO/Order.php +++ b/CRM/Financial/BAO/Order.php @@ -838,7 +838,10 @@ class CRM_Financial_BAO_Order { // Set the price set ID from the first line item (we need to set this here // to prevent a loop later when we retrieve the price field metadata to // set the 'title' (as accessed from workflow message templates). - $this->setPriceSetID($lineItems[0]['price_field_id.price_set_id']); + // Contributions *should* all have line items, but historically, imports did not create them. + if ($lineItems) { + $this->setPriceSetID($lineItems[0]['price_field_id.price_set_id']); + } } else { foreach ($this->getPriceOptions() as $fieldID => $valueID) { -- 2.25.1