remove getPermissionedEmployer fn
authormonishdeb <monish.deb@webaccessglobal.com>
Mon, 7 Sep 2015 15:12:34 +0000 (20:42 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Thu, 10 Sep 2015 08:24:31 +0000 (13:54 +0530)
CRM/Contact/BAO/Relationship.php
CRM/Contribute/Form/ContributionBase.php
CRM/Core/Page/AJAX/Location.php

index e40378157b33e57007c7c871223ef14b7a5759d6..13227f22e8c55b3da6e4093908f452884841d3d9 100644 (file)
@@ -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.
    *
index 91de4742fb0728ca07e7fed4b6c11ade11484bb5..ca91a152545f379b4344974bc9946961478bbd53 100644 (file)
@@ -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
index c5a4bda3419ae8fc23517e14916d8f974f998ff0..50473b6dbba3bc5f1906020ea240bba9b37500e7 100644 (file)
@@ -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();
     }