<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
- * $Id$
- *
+ * @copyright CiviCRM LLC (c) 2004-2015
*/
/**
- * This class generates form components for Location Type
- *
+ * This class generates form components for Location Type.
*/
class CRM_Admin_Form_LocationType extends CRM_Admin_Form {
/**
* Build the form object.
- *
- * @return void
*/
public function buildQuickForm() {
parent::buildQuickForm();
$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'));
+ }
}
}
/**
* Process the form submission.
- *
- *
- * @return void
*/
public function postProcess() {
CRM_Utils_System::flushCache('CRM_Core_DAO_LocationType');