From e4fa553bc9f7bbc4fb9bb5915cf193a7dcfe0029 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Fri, 17 Jul 2015 13:58:12 +0530 Subject: [PATCH] CRM-16776 - additional bug fixes --- CRM/Contribute/Form/ContributionPage.php | 4 ++++ CRM/Contribute/Form/ContributionPage/Custom.php | 3 --- CRM/Event/Form/ManageEvent.php | 14 ++++++++++++++ CRM/Event/Form/ManageEvent/Registration.php | 14 -------------- templates/CRM/UF/Page/ProfileTemplates.tpl | 2 +- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/CRM/Contribute/Form/ContributionPage.php b/CRM/Contribute/Form/ContributionPage.php index 8f7a1c39c0..86902cab97 100644 --- a/CRM/Contribute/Form/ContributionPage.php +++ b/CRM/Contribute/Form/ContributionPage.php @@ -109,6 +109,10 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form { } } + // CRM-16776 - show edit/copy/create buttons on Profiles Tab if user has required permission. + if (CRM_Core_Permission::check('administer CiviCRM')) { + $this->assign('perm', TRUE); + } // set up tabs CRM_Contribute_Form_ContributionPage_TabHeader::build($this); diff --git a/CRM/Contribute/Form/ContributionPage/Custom.php b/CRM/Contribute/Form/ContributionPage/Custom.php index ea730d09f2..ff76aaaa46 100644 --- a/CRM/Contribute/Form/ContributionPage/Custom.php +++ b/CRM/Contribute/Form/ContributionPage/Custom.php @@ -98,9 +98,6 @@ class CRM_Contribute_Form_ContributionPage_Custom extends CRM_Contribute_Form_Co CRM_Utils_System::setTitle(ts('Include Profiles') . " ($title)"); } - if (CRM_Core_Permission::check('administer CiviCRM')) { - $this->assign('perm', 1); - } $ufJoinParams = array( 'module' => 'CiviContribute', 'entity_table' => 'civicrm_contribution_page', diff --git a/CRM/Event/Form/ManageEvent.php b/CRM/Event/Form/ManageEvent.php index 29219519e8..b598858db1 100644 --- a/CRM/Event/Form/ManageEvent.php +++ b/CRM/Event/Form/ManageEvent.php @@ -191,6 +191,20 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form { $this->assign('isRepeatingEntity', $isRepeatingEntity); } + // CRM-16776 - show edit/copy/create buttons for Profiles if user has required permission. + $ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); + $ufCreate = CRM_ACL_API::group(CRM_Core_Permission::CREATE, NULL, 'civicrm_uf_group', $ufGroups); + $ufEdit = CRM_ACL_API::group(CRM_Core_Permission::EDIT, NULL, 'civicrm_uf_group', $ufGroups); + $checkPermission = array( + array( + 'administer CiviCRM', + 'manage event profiles', + ), + ); + if (CRM_Core_Permission::check($checkPermission) || !empty($ufCreate) || !empty($ufEdit)) { + $this->assign('perm', TRUE); + } + // also set up tabs CRM_Event_Form_ManageEvent_TabHeader::build($this); diff --git a/CRM/Event/Form/ManageEvent/Registration.php b/CRM/Event/Form/ManageEvent/Registration.php index 5c4392ac38..3a24bb1d96 100644 --- a/CRM/Event/Form/ManageEvent/Registration.php +++ b/CRM/Event/Form/ManageEvent/Registration.php @@ -75,20 +75,6 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent } } - $this->assign('perm', 0); - $ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); - $ufCreate = CRM_ACL_API::group(CRM_Core_Permission::CREATE, NULL, 'civicrm_uf_group', $ufGroups); - $ufEdit = CRM_ACL_API::group(CRM_Core_Permission::EDIT, NULL, 'civicrm_uf_group', $ufGroups); - $checkPermission = array( - array( - 'administer CiviCRM', - 'manage event profiles', - ), - ); - if (CRM_Core_Permission::check($checkPermission) || !empty($ufCreate) || !empty($ufEdit)) { - $this->assign('perm', 1); - } - $this->assign('addProfileBottomAdd', $this->_addProfileBottomAdd); $this->assign('profileBottomNumAdd', $this->_profileBottomNumAdd); diff --git a/templates/CRM/UF/Page/ProfileTemplates.tpl b/templates/CRM/UF/Page/ProfileTemplates.tpl index 7c5a78a6fd..514fac23d0 100644 --- a/templates/CRM/UF/Page/ProfileTemplates.tpl +++ b/templates/CRM/UF/Page/ProfileTemplates.tpl @@ -115,7 +115,7 @@
- {if $perm EQ 1} + {if $perm} -- 2.25.1