//custom group id
$this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this);
+ if ($isReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'is_reserved', 'id')) {
+ CRM_Core_Error::fatal("You cannot add or edit fields of a Reserved Custom Group");
+ }
+
if ($this->_gid) {
$url = CRM_Utils_System::url('civicrm/admin/custom/group/field',
"reset=1&action=browse&gid={$this->_gid}"
// current set id
$this->_id = $this->get('id');
+ if ($isReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_id, 'is_reserved', 'id')) {
+ CRM_Core_Error::fatal("You cannot edit the settings of a Reserved Custom Group");
+ }
// setting title for html page
if ($this->_action == CRM_Core_Action::UPDATE) {
$title = CRM_Core_BAO_CustomGroup::getTitle($this->_id);
$this->_fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this);
$this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this);
+
+ if ($isReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'is_reserved', 'id')) {
+ CRM_Core_Error::fatal("You cannot add or edit muliple choice options of a Reserved Custom Group Field");
+ }
if (!isset($this->_gid) && $this->_fid) {
$this->_gid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField',
$this->_fid,
$this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive',
$this
);
+
+ if ($isReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'is_reserved', 'id')) {
+ CRM_Core_Error::fatal("You cannot add or edit fields of a Reserved Custom Group");
+ }
+
$action = CRM_Utils_Request::retrieve('action', 'String',
// default to 'browse'
$this, FALSE, 'browse'
// get all custom groups sorted by weight
$customGroup = array();
$dao = new CRM_Core_DAO_CustomGroup();
-
+ $dao->is_reserved = FALSE;
$dao->orderBy('weight, title');
$dao->find();
$this, FALSE, 0
);
+ if ($isReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'is_reserved', 'id')) {
+ CRM_Core_Error::fatal("You cannot add or edit muliple choice options of a Reserved Custom Group Field");
+ }
+
//as url contain $gid so append breadcrumb dynamically.
$breadcrumb = array(array('title' => ts('Custom Data Fields'),
'url' => CRM_Utils_System::url('civicrm/admin/custom/group/field', 'reset=1&gid=' . $this->_gid),
( uf_group_id, field_name, is_required, is_reserved, weight, visibility, in_selector, is_searchable, location_type_id, {localize field='label'}label{/localize}, field_type, help_post, phone_type_id )
VALUES
( @uf_group_contribution_batch_entry, 'soft_credit', 0, 0, 10, 'User and User Admin Only', 0, 0, NULL, {localize}'Soft Credit'{/localize}, 'Contribution', NULL, NULL ),
- ( @uf_group_membership_batch_entry, 'soft_credit', 0, 0, 13, 'User and User Admin Only', 0, 0, NULL, {localize}'Soft Credit'{/localize}, 'Membership', NULL, NULL );
\ No newline at end of file
+ ( @uf_group_membership_batch_entry, 'soft_credit', 0, 0, 13, 'User and User Admin Only', 0, 0, NULL, {localize}'Soft Credit'{/localize}, 'Membership', NULL, NULL );
+
+-- CRM-12809
+ALTER TABLE `civicrm_custom_group`
+ ADD COLUMN `is_reserved` tinyint(4) DEFAULT '0' COMMENT 'Is this a reserved Custom Group?';
<comment>Date and time this custom group was created.</comment>
<add>3.0</add>
</field>
+ <field>
+ <name>is_reserved</name>
+ <type>boolean</type>
+ <default>0</default>
+ <comment>Is this a reserved Custom Group?</comment>
+ <add>4.4</add>
+ </field>
</table>