From a9ed1dc04cc7d0509ecba2629becf3e160b7cb6d Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Wed, 24 Dec 2014 03:53:11 +0530 Subject: [PATCH] --CRM-15758, added code to invoke pre and post hook --- CRM/Financial/BAO/FinancialItem.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CRM/Financial/BAO/FinancialItem.php b/CRM/Financial/BAO/FinancialItem.php index 2427c08aec..2802aa41a4 100644 --- a/CRM/Financial/BAO/FinancialItem.php +++ b/CRM/Financial/BAO/FinancialItem.php @@ -132,6 +132,14 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem { */ static function create(&$params, $ids = NULL, $trxnIds = NULL) { $financialItem = new CRM_Financial_DAO_FinancialItem(); + + if (!empty($ids['id'])) { + CRM_Utils_Hook::pre('edit', 'FinancialItem', $ids['id'], $params); + } + else { + CRM_Utils_Hook::pre('create', 'FinancialItem', NULL, $params); + } + $financialItem->copyValues($params); if (!empty($ids['id'])) { $financialItem->id = $ids['id']; @@ -153,6 +161,12 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem { } $entity_trxn->save(); } + if (!empty($ids['id'])) { + CRM_Utils_Hook::post('edit', 'FinancialItem', $financialItem->id, $financialItem); + } + else { + CRM_Utils_Hook::post('create', 'FinancialItem', $financialItem->id, $financialItem); + } return $financialItem; } -- 2.25.1