--CRM-18204, modified code to use checkProfileType function
authorPradeep Nayak <pradpnayak@gmail.com>
Fri, 11 Mar 2016 08:40:25 +0000 (14:10 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Fri, 11 Mar 2016 08:40:25 +0000 (14:10 +0530)
CRM/UF/Page/Field.php
CRM/UF/Page/Group.php

index ef76bec53e28025b5010d296d2f0e0b4427071bb..7fb6b880eb03be003ca612ccf13304570a35349e 100644 (file)
@@ -125,10 +125,8 @@ class CRM_UF_Page_Field extends CRM_Core_Page {
     $isGroupReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'is_reserved');
     $this->assign('isGroupReserved', $isGroupReserved);
 
-    $profileType = CRM_Core_BAO_UFField::getProfileType($this->_gid);
-    $contactTypes = CRM_Contact_BAO_ContactType::contactTypes();
-    $contactTypes[] = 'Contact';
-    if (!in_array($profileType, $contactTypes)) {
+    $isMixedProfile = CRM_Core_BAO_UFField::checkProfileType($this->_gid);
+    if ($isMixedProfile) {
       $this->assign('skipCreate', TRUE);
     }
 
index 43b06697bfbe7fd6e11812c5c8bd1d2750644c82..aa60dd5e571cc0fd0fd05d74ad498936c8ac96b6 100644 (file)
@@ -352,10 +352,8 @@ class CRM_UF_Page_Group extends CRM_Core_Page {
 
       // drop Create, Edit and View mode links if profile group_type is one of the following:
       // Contribution, Membership, Activity, Participant, Case, Grant
-      $contactTypes = CRM_Contact_BAO_ContactType::contactTypes();
-      $contactTypes[] = 'Contact';
-      $componentFound = array_diff(array_keys($groupTypes), $contactTypes);
-      if (!empty($componentFound)) {
+      $isMixedProfile = CRM_Core_BAO_UFField::checkProfileType($id);
+      if ($isMixedProfile) {
         $action -= CRM_Core_Action::ADD;
         $action -= CRM_Core_Action::ADVANCED;
         $action -= CRM_Core_Action::BASIC;