From 7688c6be47b8b41a170580403e9c73443143854c Mon Sep 17 00:00:00 2001 From: "Donald A. Lobo" Date: Tue, 5 Nov 2013 09:57:10 -0800 Subject: [PATCH] CRM-13704 - Fatal error prevents deletion of options from custom fields http://issues.civicrm.org/jira/browse/CRM-13704 --- CRM/Custom/Form/Option.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/CRM/Custom/Form/Option.php b/CRM/Custom/Form/Option.php index 1963d467f5..d43a974f17 100644 --- a/CRM/Custom/Form/Option.php +++ b/CRM/Custom/Form/Option.php @@ -80,22 +80,26 @@ class CRM_Custom_Form_Option extends CRM_Core_Form { $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 in a reserved custom field-set."); - } if (!isset($this->_gid) && $this->_fid) { - $this->_gid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', + $this->_gid = CRM_Core_DAO::getFieldValue( + 'CRM_Core_DAO_CustomField', $this->_fid, 'custom_group_id' ); } + if ($this->_fid) { - $this->_optionGroupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', + $this->_optionGroupID = CRM_Core_DAO::getFieldValue( + 'CRM_Core_DAO_CustomField', $this->_fid, 'option_group_id' ); } + 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 in a reserved custom field-set."); + } + $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); } -- 2.25.1