From 4b1ba25cd461a48cae34e5380ecb8e8efc162629 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 7 Jan 2022 16:05:58 +1300 Subject: [PATCH] Stop calling hook twice Per the code comments this hook is called here but also in add. This is all about the crazy history of this function - which used to be tied to the relationship form. I can't think of any valid use for calling the hook twice - but I can think of reasons it would be bad... --- CRM/Contact/BAO/Contact/Utils.php | 6 ------ CRM/Contact/BAO/Relationship.php | 5 ----- 2 files changed, 11 deletions(-) diff --git a/CRM/Contact/BAO/Contact/Utils.php b/CRM/Contact/BAO/Contact/Utils.php index fbc52b4daa..f5d05331e7 100644 --- a/CRM/Contact/BAO/Contact/Utils.php +++ b/CRM/Contact/BAO/Contact/Utils.php @@ -332,12 +332,6 @@ WHERE id IN ( $idString ) $relationships = $relationshipIds = []; $ids = ['contact' => $contactID]; - //CRM-9015 - the hooks are called here & in add (since add doesn't call create) - // but in future should be tidied per ticket - $hook = 'create'; - // @todo pre hook is called from add - remove it from here - CRM_Utils_Hook::pre($hook, 'Relationship', NULL, $params); - // creating a new relationship $dataExists = CRM_Contact_BAO_Relationship::dataExists($params); if (!$dataExists) { diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index b2972fb486..418f2218c7 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -174,11 +174,6 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { $ids = ['contact' => $ids['contact']]; // Likewise neither place ever passed in relationshipID $relationshipId = NULL; - $hook = 'create'; - // CRM-9015 - the hooks are called here & in add (since add doesn't call create) - // but in future should be tidied per ticket - // @todo pre hook is called from add - remove it from here - CRM_Utils_Hook::pre($hook, 'Relationship', $relationshipId, $params); if (!$relationshipId) { // creating a new relationship -- 2.25.1