From a1acfd535f3d8c354cad923db40c3e968ba132ac Mon Sep 17 00:00:00 2001 From: monishdeb Date: Thu, 7 May 2015 00:52:52 +0530 Subject: [PATCH 1/1] CRM-16437 fix - Participant export retains all fee levels after change https://issues.civicrm.org/jira/browse/CRM-16437 --- CRM/Event/BAO/Participant.php | 11 +++++++---- CRM/Price/BAO/PriceSet.php | 6 +----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index 66b8505504..235390a5b7 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -2047,10 +2047,13 @@ WHERE (li.entity_table = 'civicrm_participant' AND li.entity_id = {$participantI // update participant fee_amount column $partUpdateFeeAmt['id'] = $participantId; - foreach ($lineItems as $lineValue) { - if ($lineValue['price_field_value_id']) { - $line[$lineValue['price_field_value_id']] = $lineValue['label'] . ' - ' . $lineValue['qty']; - } + $getUpdatedLineItems = "SELECT * +FROM civicrm_line_item +WHERE (entity_table = 'civicrm_participant' AND entity_id = {$participantId} AND qty > 0) + "; + $getUpdatedLineItemsDAO = CRM_Core_DAO::executeQuery($getUpdatedLineItems); + while ($getUpdatedLineItemsDAO->fetch()) { + $line[$getUpdatedLineItemsDAO->price_field_value_id] = $getUpdatedLineItemsDAO->label . ' - ' . (float) $getUpdatedLineItemsDAO->qty; } $partUpdateFeeAmt['fee_level'] = implode(', ', $line); diff --git a/CRM/Price/BAO/PriceSet.php b/CRM/Price/BAO/PriceSet.php index 6cd8379ee6..1d05a1efd3 100644 --- a/CRM/Price/BAO/PriceSet.php +++ b/CRM/Price/BAO/PriceSet.php @@ -879,11 +879,7 @@ WHERE id = %1"; if (is_array($lineItem)) { foreach ($lineItem as $values) { $totalParticipant += $values['participant_count']; - if ($values['html_type'] == 'Text') { - $amount_level[] = $values['label'] . ' - ' . $values['qty']; - continue; - } - $amount_level[] = $values['label']; + $amount_level[] = $values['label'] . ' - ' . (float) $values['qty']; } } -- 2.25.1