diff --git a/app/Controller/ApplicationPreferencesController.php b/app/Controller/ApplicationPreferencesController.php index cbcff40f5..bc60cd818 100644 --- a/app/Controller/ApplicationPreferencesController.php +++ b/app/Controller/ApplicationPreferencesController.php @@ -97,7 +97,7 @@ public function store() { // We expect a simple json doc of { "value": "foo" }, but if we don't have // a valid value we'll just treat it as a null. The client can also pass // { "value": null } - $value = !empty($this->request->data['value']) ? $this->request->data['value'] : null; + $value = $this->request->data['value'] ?? null; try { $this->ApplicationPreference->store($coPersonId, $this->request->params['tag'], $value); diff --git a/app/Controller/CoEnrollmentAttributesController.php b/app/Controller/CoEnrollmentAttributesController.php index f42c5d298..e57aab022 100644 --- a/app/Controller/CoEnrollmentAttributesController.php +++ b/app/Controller/CoEnrollmentAttributesController.php @@ -302,7 +302,7 @@ function beforeRender() { // the dropdown won't either). if(!empty($this->viewVars['co_enrollment_attributes'][0]['CoEnrollmentAttribute']['attribute']) && $this->viewVars['co_enrollment_attributes'][0]['CoEnrollmentAttribute']['attribute'] == 'r:sponsor_co_person_id' - && !empty($this->viewVars['co_enrollment_attributes'][0]['CoEnrollmentAttributeDefault'][0]['value'])) { + && isset($this->viewVars['co_enrollment_attributes'][0]['CoEnrollmentAttributeDefault'][0]['value'])) { // The default value is a CO Person ID $args = array(); $args['conditions']['CoPerson.id'] = $this->viewVars['co_enrollment_attributes'][0]['CoEnrollmentAttributeDefault'][0]['value']; @@ -315,7 +315,7 @@ function beforeRender() { // Also populate the current manager, if set if(!empty($this->viewVars['co_enrollment_attributes'][0]['CoEnrollmentAttribute']['attribute']) && $this->viewVars['co_enrollment_attributes'][0]['CoEnrollmentAttribute']['attribute'] == 'r:manager_co_person_id' - && !empty($this->viewVars['co_enrollment_attributes'][0]['CoEnrollmentAttributeDefault'][0]['value'])) { + && isset($this->viewVars['co_enrollment_attributes'][0]['CoEnrollmentAttributeDefault'][0]['value'])) { // The default value is a CO Person ID $args = array(); $args['conditions']['CoPerson.id'] = $this->viewVars['co_enrollment_attributes'][0]['CoEnrollmentAttributeDefault'][0]['value']; diff --git a/app/Model/CoEnrollmentAttribute.php b/app/Model/CoEnrollmentAttribute.php index 36118a4c0..142922677 100644 --- a/app/Model/CoEnrollmentAttribute.php +++ b/app/Model/CoEnrollmentAttribute.php @@ -446,7 +446,7 @@ public function enrollmentFlowAttributes($coef, $defaultValues=array(), $archive // Currently, they are always modifiable. $attr['default'] = $defaultValues[ $attr['model'] ][ $attr['field'] ]; $attr['modifiable'] = true; - } elseif(!empty($efAttr['CoEnrollmentAttributeDefault'][0]['value'])) { + } elseif(isset($efAttr['CoEnrollmentAttributeDefault'][0]['value'])) { // These are the default values configured per-enrollment flow attribute if(($attrCode == 'r' diff --git a/app/View/CoEnrollmentAttributes/fields.inc b/app/View/CoEnrollmentAttributes/fields.inc index c24e0a138..8085f296b 100644 --- a/app/View/CoEnrollmentAttributes/fields.inc +++ b/app/View/CoEnrollmentAttributes/fields.inc @@ -55,8 +55,11 @@ break; } - - return ret; + if (ret != undefined) { + return sortProperties(ret) + } + + return ret } function ext_attr_type(attrname) { @@ -143,8 +146,8 @@ if(enums != undefined) { // Enumerations are defined for the attribute, so generate an appropriate select var options = ""; - for(let id of Object.keys(enums)) { - options += ""; + for(let i=0; i" + enums[i][1] + ""; } $("#def_enum_val").find('option').remove().end().append($(options)); @@ -356,7 +359,7 @@ } if ($.inArray(cur_value, attributesProperty) !== -1) { option.attr('selected', 'selected'); - + option.attr('data-default', ''); } @@ -484,12 +487,12 @@ print $this->Form->hidden('CoEnrollmentAttributeDefault.0.co_enrollment_attribute_id') . "\n"; } - $co_enrollment_attribute_attribute = !empty($co_enrollment_attributes[0]['CoEnrollmentAttribute']['attribute']) + $co_enrollment_attribute_attribute = isset($co_enrollment_attributes[0]['CoEnrollmentAttribute']['attribute']) ? filter_var($co_enrollment_attributes[0]['CoEnrollmentAttribute']['attribute'],FILTER_SANITIZE_SPECIAL_CHARS) : ''; print $this->Form->hidden('attribute', array('value' => $co_enrollment_attribute_attribute)) . "\n"; - $co_enrollment_attribute_value_def = !empty($co_enrollment_attributes[0]['CoEnrollmentAttributeDefault'][0]['value']) + $co_enrollment_attribute_value_def = isset($co_enrollment_attributes[0]['CoEnrollmentAttributeDefault'][0]['value']) ? filter_var($co_enrollment_attributes[0]['CoEnrollmentAttributeDefault'][0]['value'],FILTER_SANITIZE_SPECIAL_CHARS) : ''; print $this->Form->hidden('CoEnrollmentAttributeDefault.0.value', array('value' => filter_var($co_enrollment_attribute_value_def,FILTER_SANITIZE_SPECIAL_CHARS))) . "\n"; @@ -499,6 +502,7 @@
+ + + + + + + + + + +

@@ -510,6 +514,7 @@ : filter_var($co_enrollment_attributes[0]['CoEnrollmentAttribute']['label'],FILTER_SANITIZE_SPECIAL_CHARS)); ?>

@@ -521,6 +526,7 @@ : filter_var($co_enrollment_attributes[0]['CoEnrollmentAttribute']['description'],FILTER_SANITIZE_SPECIAL_CHARS)); ?>
@@ -634,6 +640,7 @@
@@ -660,6 +667,7 @@ ?>
@@ -677,6 +685,7 @@

@@ -688,6 +697,7 @@ : filter_var($co_enrollment_attributes[0]['CoEnrollmentAttribute']['default_env'],FILTER_SANITIZE_SPECIAL_CHARS)); ?>

@@ -699,6 +709,7 @@ : filter_var($co_enrollment_attributes[0]['CoEnrollmentAttribute']['ordr'],FILTER_SANITIZE_SPECIAL_CHARS)); ?>

@@ -729,11 +740,13 @@

+
+
+
+
+
@@ -890,6 +909,7 @@
+
@@ -954,6 +974,7 @@

@@ -967,6 +988,7 @@ ? _txt('fd.yes') : _txt('fd.no'))); ?>

diff --git a/app/View/CoPetitions/petition-attributes.inc b/app/View/CoPetitions/petition-attributes.inc index 97dff6401..e73b62d17 100644 --- a/app/View/CoPetitions/petition-attributes.inc +++ b/app/View/CoPetitions/petition-attributes.inc @@ -390,7 +390,7 @@ 'fieldName' => $fieldName, 'modelName' => $ea['model'], 'required' => $ea['required'], - 'default' => $ea['default'] + 'default' => $ea['default'] ?? '' ); print $this->element('enumerableField', $args); break; diff --git a/app/View/Elements/enumerableField.ctp b/app/View/Elements/enumerableField.ctp index 3e8683502..2bcbc49df 100644 --- a/app/View/Elements/enumerableField.ctp +++ b/app/View/Elements/enumerableField.ctp @@ -70,7 +70,7 @@ $allowOther = isset($vv_enums[$field]['allow_other']) && $vv_enums[$field]['allo -
+