From: Coleman Watts Date: Fri, 7 Aug 2015 18:43:50 +0000 (-0400) Subject: CRM-12021 - Don't allow no default location type X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ea9cdce1aef2ec3fa62a30a4aeafc6b70fa64f27;p=civicrm-core.git CRM-12021 - Don't allow no default location type --- 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')); + } } }