--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:45:30 +0000 (14:15 +0530)
CRM/UF/Page/Field.php
CRM/UF/Page/Group.php

index 11b5189ed50345e63a4356c30b07931bd6a85747..12cc49594f7cceb4b5d3cf0a7b53c75e2b84b20b 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 37332502085fda708eaa25e47c36226619eacf04..d08c024fc06a656668ded4770e48336c3ff7b1be 100644 (file)
@@ -345,10 +345,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::BASIC;
         $action -= CRM_Core_Action::PROFILE;