From 9b34bf68993ef9c11dddb27340fc388118748625 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 28 May 2015 11:30:04 +0000 Subject: [PATCH] * CustomFields: keep order of select-options (was not working for nummeric values) fixed #9613: Order of customs field in a selectbox has changed --- .../inc/class.etemplate_widget_customfields.inc.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/etemplate/inc/class.etemplate_widget_customfields.inc.php b/etemplate/inc/class.etemplate_widget_customfields.inc.php index 5015330d5d..5533a6b64e 100644 --- a/etemplate/inc/class.etemplate_widget_customfields.inc.php +++ b/etemplate/inc/class.etemplate_widget_customfields.inc.php @@ -149,7 +149,7 @@ class etemplate_widget_customfields extends etemplate_widget_transformer $field_filters []= $f; } } - + $fields = $customfields; $use_private = self::expand_name($this->attrs['use-private'],0,0,'','',self::$cont); @@ -309,6 +309,13 @@ class etemplate_widget_customfields extends etemplate_widget_transformer self::$request->sel_options[self::$prefix.$fname] = $field['values']; } //error_log(__METHOD__."('$fname', ".array2string($field).") request->sel_options['".self::$prefix.$fname."']=".array2string(self::$request->sel_options[$this->id])); + // to keep order of numeric values, we have to explicit run fix_encoded_options, as sel_options are already encoded + $options = self::$request->sel_options[self::$prefix.$fname]; + if (is_array($options)) + { + etemplate_widget_menupopup::fix_encoded_options($options); + self::$request->sel_options[self::$prefix.$fname] = $options; + } break; } return $widget;