From ea9cdce1aef2ec3fa62a30a4aeafc6b70fa64f27 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 7 Aug 2015 14:43:50 -0400 Subject: [PATCH] CRM-12021 - Don't allow no default location type --- CRM/Admin/Form/LocationType.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CRM/Admin/Form/LocationType.php b/CRM/Admin/Form/LocationType.php index 6fd84846d6..7d7f01f080 100644 --- a/CRM/Admin/Form/LocationType.php +++ b/CRM/Admin/Form/LocationType.php @@ -76,8 +76,14 @@ class CRM_Admin_Form_LocationType extends CRM_Admin_Form { $this->add('checkbox', 'is_active', ts('Enabled?')); $this->add('checkbox', 'is_default', ts('Default?')); - if ($this->_action == CRM_Core_Action::UPDATE && CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType', $this->_id, 'is_reserved')) { - $this->freeze(array('name', 'description', 'is_active')); + + if ($this->_action & CRM_Core_Action::UPDATE) { + if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType', $this->_id, 'is_reserved')) { + $this->freeze(array('name', 'description', 'is_active')); + } + if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType', $this->_id, 'is_default')) { + $this->freeze(array('is_default')); + } } } -- 2.25.1