From cad42eb6aa16d3a4741d59f88a13c5f9f71d7feb Mon Sep 17 00:00:00 2001 From: ralf Date: Wed, 10 Aug 2022 14:39:19 +0200 Subject: [PATCH] fix validation of taglist now send to select, specially using "id" attribute, if there is no "value" also check modifications of select_options, as done in preferences fixes not validating mail preferences: toggleOnActions and contactLabel --- api/src/Etemplate/Widget/Select.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/api/src/Etemplate/Widget/Select.php b/api/src/Etemplate/Widget/Select.php index c453326443..7645a239d2 100644 --- a/api/src/Etemplate/Widget/Select.php +++ b/api/src/Etemplate/Widget/Select.php @@ -506,10 +506,17 @@ class Select extends Etemplate\Widget } // Check for options-$name in content - if (is_array(self::$request->content['options-'.$name])) + if (isset(self::$request->content['options-'.$name]) && is_array(self::$request->content['options-'.$name])) { $options += self::$request->content['options-'.$name]; } + + // check modifications + if (isset(self::$request->modifications[$name]['select_options']) && is_array(self::$request->modifications[$name]['select_options'])) + { + $options += self::$request->modifications[$name]['select_options']; + } + if ($return_values) { $values = array(); @@ -521,12 +528,17 @@ class Select extends Etemplate\Widget { $values[] = $val['value']; } - else if ((isset($val['label']) || isset($val['title'])) && count($val) == 1 || + elseif ((isset($val['label']) || isset($val['title'])) && count($val) == 1 || isset($val['title']) && isset($val['label']) && count($val) == 2) { // key => {label, title} $values[] = $key; } + // support "id" used instead of "value" by old taglist + elseif (isset($val['id'])) + { + $values[] = $val['id']; + } else // optgroup { foreach($val as $k => $v)