CRM-19929: added missing pre hooks for entity tags
authorKurund Jalmi <kurund@yahoo.com>
Wed, 25 Jan 2017 10:28:00 +0000 (15:58 +0530)
committerKurund Jalmi <kurund@yahoo.com>
Wed, 25 Jan 2017 10:28:00 +0000 (15:58 +0530)
CRM/Core/BAO/EntityTag.php

index 6b4a74e9131e559601d315a101ea43ff7fbbd211..a935a20e63d5894db5c68c96ba9fdcf626f2b60f 100644 (file)
@@ -81,6 +81,9 @@ class CRM_Core_BAO_EntityTag extends CRM_Core_DAO_EntityTag {
 
     // dont save the object if it already exists, CRM-1276
     if (!$entityTag->find(TRUE)) {
+      //invoke pre hook
+      CRM_Utils_Hook::pre('create', 'EntityTag', $params['tag_id'], $params);
+
       $entityTag->save();
 
       //invoke post hook on entityTag
@@ -142,6 +145,10 @@ class CRM_Core_BAO_EntityTag extends CRM_Core_DAO_EntityTag {
     $numEntitiesNotAdded = 0;
     $entityIdsAdded = array();
 
+    //invoke pre hook for entityTag
+    $preObject = array($entityIds, $entityTable);
+    CRM_Utils_Hook::pre('create', 'EntityTag', $tagId, $preObject);
+
     foreach ($entityIds as $entityId) {
       // CRM-17350 - check if we have permission to edit the contact
       // that this tag belongs to.