CRM-21281: Restore entity reference in case the post hook needs it
authorNicolas Ganivet <nicolas@cividesk.com>
Tue, 10 Oct 2017 06:26:37 +0000 (00:26 -0600)
committerNicolas Ganivet <nicolas@cividesk.com>
Tue, 10 Oct 2017 06:31:34 +0000 (00:31 -0600)
CRM/Price/BAO/LineItem.php

index 2b782e48f8047dd0acb5812d9ac5eac82eaf629b..f064c526b3f259653070ed8b1e1a2ade167ed530 100644 (file)
@@ -70,6 +70,8 @@ class CRM_Price_BAO_LineItem extends CRM_Price_DAO_LineItem {
     // unset entity table and entity id in $params
     // we never update the entity table and entity id during update mode
     if ($id) {
+      $entity_id = $params['entity_id'];
+      $entity_table = $params['entity_table'];
       unset($params['entity_id'], $params['entity_table']);
     }
     else {
@@ -102,6 +104,9 @@ class CRM_Price_BAO_LineItem extends CRM_Price_DAO_LineItem {
     }
 
     if ($id) {
+      // CRM-21281: Restore entity reference in case the post hook needs it
+      $lineItemBAO->entity_id = $entity_id;
+      $lineItemBAO->entity_table = $entity_table;
       CRM_Utils_Hook::post('edit', 'LineItem', $id, $lineItemBAO);
     }
     else {