From 74ee0fba1594fc2102e6e1e2f9a1e420db00fb9b Mon Sep 17 00:00:00 2001 From: Dave Greenberg Date: Thu, 1 May 2014 13:22:46 -0700 Subject: [PATCH] CRM-14488 - Additional fix for profiles with multiple Used For entries in uf_join table ---------------------------------------- * CRM-14488: https://issues.civicrm.org/jira/browse/CRM-14488 --- CRM/Profile/Form/Edit.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CRM/Profile/Form/Edit.php b/CRM/Profile/Form/Edit.php index 2b65792a69..ce65944bce 100644 --- a/CRM/Profile/Form/Edit.php +++ b/CRM/Profile/Form/Edit.php @@ -125,18 +125,23 @@ class CRM_Profile_Form_Edit extends CRM_Profile_Form { SELECT module,is_reserved FROM civicrm_uf_group LEFT JOIN civicrm_uf_join ON uf_group_id = civicrm_uf_group.id - WHERE civicrm_uf_group.id = %1 + WHERE civicrm_uf_group.id = %1 "; + $params = array(1 => array($this->_gid, 'Integer')); $dao = CRM_Core_DAO::executeQuery($query, $params); - $error = $dao->fetch(); + + $isProfile = false; + while ($dao->fetch()) { + $isProfile = ($isProfile || ($dao->module == "Profile")); + } //Check that the user has the "add contacts" Permission $canAdd = CRM_Core_Permission::check("add contacts"); //Remove need for Profile module type when using reserved profiles [CRM-14488] - if( !$error || ($dao->module != "Profile" && !($dao->is_reserved && $canAdd))) { + if( !$dao->N || (!$isProfile && !($dao->is_reserved && $canAdd))) { CRM_Core_Error::fatal(ts('The requested Profile (gid=%1) is not configured to be used for \'Profile\' edit and view forms in its Settings. Contact the site administrator if you need assistance.', array(1 => $this->_gid) )); -- 2.25.1