CRM-16437 fix - Participant export retains all fee levels after change
authormonishdeb <monish.deb@webaccessglobal.com>
Wed, 6 May 2015 19:22:52 +0000 (00:52 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Wed, 6 May 2015 19:22:52 +0000 (00:52 +0530)
https://issues.civicrm.org/jira/browse/CRM-16437

CRM/Event/BAO/Participant.php
CRM/Price/BAO/PriceSet.php

index 66b8505504382c6083093180cdc91edb48d76345..235390a5b7d96a0b9108cb74bd276dc526d5d6b9 100644 (file)
@@ -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);
index 6cd8379ee64b76c0a20bfd9026f8e6be9c14b6c1..1d05a1efd3cb0fb0258015710ecd849cac75f8ed 100644 (file)
@@ -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'];
       }
     }