From c1580939c2b3b722aa328866e162850f763c7d01 Mon Sep 17 00:00:00 2001 From: monishdeb Date: Mon, 7 Sep 2015 20:42:34 +0530 Subject: [PATCH] remove getPermissionedEmployer fn --- CRM/Contact/BAO/Relationship.php | 22 ---------------------- CRM/Contribute/Form/ContributionBase.php | 10 ++++++++-- CRM/Core/Page/AJAX/Location.php | 5 ++++- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index e40378157b..13227f22e8 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -1741,28 +1741,6 @@ WHERE id IN ( {$contacts} ) return $currentEmployer; } - /** - * Return list of permissioned employer for a given contact. - * - * @param int $contactID - * contact id whose employers. - * are to be found. - * @param string $name - * employers sort name. - * - * @return array - * array of employers. - */ - public static function getPermissionedEmployer($contactID, $name = NULL) { - //get the relationship id - $relTypeId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', - 'Employee of', 'id', 'name_a_b' - ); - - return self::getPermissionedContacts($contactID, $relTypeId, $name); - } - - /** * Function to return list of permissioned contacts for a given contact and relationship type. * diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 91de4742fb..ca91a15254 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -215,7 +215,10 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { $this->_defaultMemTypeId = $membership->membership_type_id; if ($membership->contact_id != $this->_contactID) { $validMembership = FALSE; - $employers = CRM_Contact_BAO_Relationship::getPermissionedEmployer($this->_userID); + $employers = CRM_Contact_BAO_Relationship::getPermissionedContacts( + $this->_userID, + CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', 'Employee of', 'id', 'name_a_b') + ); if (!empty($employers) && array_key_exists($membership->contact_id, $employers)) { $this->_membershipContactID = $membership->contact_id; $this->assign('membershipContactID', $this->_membershipContactID); @@ -815,7 +818,10 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { } if ($contactID) { - $employer = CRM_Contact_BAO_Relationship::getPermissionedEmployer($contactID); + $employers = CRM_Contact_BAO_Relationship::getPermissionedContacts( + $contactID, + CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', 'Employee of', 'id', 'name_a_b') + ); if (count($employer)) { // Related org url - pass checksum if needed diff --git a/CRM/Core/Page/AJAX/Location.php b/CRM/Core/Page/AJAX/Location.php index c5a4bda341..50473b6dbb 100644 --- a/CRM/Core/Page/AJAX/Location.php +++ b/CRM/Core/Page/AJAX/Location.php @@ -58,7 +58,10 @@ class CRM_Core_Page_AJAX_Location { } // Verify user permission on related contact - $employers = CRM_Contact_BAO_Relationship::getPermissionedContacts($user); + $employers = CRM_Contact_BAO_Relationship::getPermissionedContacts( + $user, + CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', 'Employee of', 'id', 'name_a_b') + ); if (!isset($employers[$cid])) { CRM_Utils_System::civiExit(); } -- 2.25.1