From cdf7ac4a5b0bd450623bdb53217e606bee5c4a23 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton <emcnaughton@wikimedia.org> Date: Fri, 25 Mar 2022 12:27:36 +1300 Subject: [PATCH] dev/core#3134 Fix regression on unselected lineitem --- CRM/Financial/BAO/Order.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CRM/Financial/BAO/Order.php b/CRM/Financial/BAO/Order.php index 9e84402c55b..935403d1638 100644 --- a/CRM/Financial/BAO/Order.php +++ b/CRM/Financial/BAO/Order.php @@ -793,12 +793,14 @@ class CRM_Financial_BAO_Order { } else { foreach ($this->getPriceOptions() as $fieldID => $valueID) { - $this->setPriceSetIDFromSelectedField($fieldID); - $throwAwayArray = []; - // @todo - still using getLine for now but better to bring it to this class & do a better job. - $newLines = CRM_Price_BAO_PriceSet::getLine($params, $throwAwayArray, $this->getPriceSetID(), $this->getPriceFieldSpec($fieldID), $fieldID)[1]; - foreach ($newLines as $newLine) { - $lineItems[$newLine['price_field_value_id']] = $newLine; + if ($valueID !== '') { + $this->setPriceSetIDFromSelectedField($fieldID); + $throwAwayArray = []; + // @todo - still using getLine for now but better to bring it to this class & do a better job. + $newLines = CRM_Price_BAO_PriceSet::getLine($params, $throwAwayArray, $this->getPriceSetID(), $this->getPriceFieldSpec($fieldID), $fieldID)[1]; + foreach ($newLines as $newLine) { + $lineItems[$newLine['price_field_value_id']] = $newLine; + } } } } -- GitLab