From: monishdeb Date: Wed, 1 Jul 2015 07:07:21 +0000 (+0530) Subject: CRM-16780 fix - Fatal Error on Relationship Edit page X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2a300b65838d4c7c4d6428222cfc0cc0efd1f485;p=civicrm-core.git CRM-16780 fix - Fatal Error on Relationship Edit page https://issues.civicrm.org/jira/browse/CRM-16780 --- diff --git a/CRM/Contact/Form/DedupeRules.php b/CRM/Contact/Form/DedupeRules.php index 6d487960f9..4361c3ab47 100644 --- a/CRM/Contact/Form/DedupeRules.php +++ b/CRM/Contact/Form/DedupeRules.php @@ -115,8 +115,7 @@ class CRM_Contact_Form_DedupeRules extends CRM_Admin_Form { $disabled = array(); $reserved = $this->addField('is_reserved', array('label' => ts('Reserved?'))); if (!empty($this->_defaults['is_reserved'])) { - //$reserved->freeze(); - $disabled = array('disabled' => TRUE); + $reserved->freeze(); } $attributes = array('class' => 'two'); diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index c8aae927f7..b48697b57e 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1259,6 +1259,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * @param bool $required * @throws \CiviCRM_API3_Exception * @throws \Exception + * @return HTML_QuickForm_Element */ public function addField($name, $props = array(), $required = FALSE) { // TODO: Handle custom field @@ -1361,25 +1362,25 @@ class CRM_Core_Form extends HTML_QuickForm_Page { case 'Link': //TODO: Autodetect ranges $props['size'] = isset($props['size']) ? $props['size'] : 60; - $this->add('text', $name, $label, $props, $required); + return $this->add('text', $name, $label, $props, $required); break; case 'hidden': - $this->add('hidden', $name, NULL, $props, $required); + return $this->add('hidden', $name, NULL, $props, $required); break; case 'TextArea': //Set default columns and rows for textarea. $props['rows'] = isset($props['rows']) ? $props['rows'] : 4; $props['cols'] = isset($props['cols']) ? $props['cols'] : 60; - $this->addElement('textarea', $name, $label, $props, $required); + return $this->addElement('textarea', $name, $label, $props, $required); break; case 'Select Date': //TODO: add range support //TODO: Add date formats //TODO: Add javascript template for dates. - $this->addDate($name, $label, $required, $props); + return $this->addDate($name, $label, $required, $props); break; case 'Radio': @@ -1388,30 +1389,30 @@ class CRM_Core_Form extends HTML_QuickForm_Page { if (!isset($props['allowClear'])) { $props['allowClear'] = !$required; } - $this->addRadio($name, $label, $options, $props, $separator, $required); + return $this->addRadio($name, $label, $options, $props, $separator, $required); break; case 'Select': if (empty($props['multiple'])) { $options = array('' => $props['placeholder']) + $options; } - $this->add('select', $name, $label, $options, $required, $props); + return $this->add('select', $name, $label, $options, $required, $props); // TODO: Add and/or option for fields that store multiple values break; case 'CheckBoxGroup': - $this->addCheckBox($name, $label, array_flip($options), $required, $props); + return $this->addCheckBox($name, $label, array_flip($options), $required, $props); break; case 'RadioGroup': - $this->addRadio($name, $label, $options, $props, NULL, $required); + return $this->addRadio($name, $label, $options, $props, NULL, $required); break; //case 'AdvMulti-Select': case 'CheckBox': $text = isset($props['text']) ? $props['text'] : NULL; unset($props['text']); - $this->addElement('checkbox', $name, $label, $text, $props); + return $this->addElement('checkbox', $name, $label, $text, $props); break; case 'File': @@ -1419,15 +1420,16 @@ class CRM_Core_Form extends HTML_QuickForm_Page { if (isset($props['context']) && $props['context'] == 'search') { return; } - $this->add('file', $name, $label, $props, $required); + $file = $this->add('file', $name, $label, $props, $required); $this->addUploadElement($name); + return $file; break; //case 'RichTextEditor': //TODO: Add javascript template for wysiwyg. case 'Autocomplete-Select': case 'EntityRef': - $this->addEntityRef($name, $label, $props, $required); + return $this->addEntityRef($name, $label, $props, $required); break; // Check datatypes of fields