fixed advanced search was always filtering by first option of custom-fields of type select or select-*

This commit is contained in:
Ralf Becker 2014-09-09 08:36:34 +00:00
parent fd9519ccfe
commit b1f0448b6d
3 changed files with 17 additions and 3 deletions

View File

@ -2676,7 +2676,7 @@ window.egw_LAB.wait(function() {
{
foreach($this->customfields as $name => $data)
{
if ($data['type'] == 'select')
if (substr($data['type'], 0, 6) == 'select' && !($data['rows'] > 1))
{
if (!isset($content['#'.$name])) $content['#'.$name] = '';
if(!isset($data['values'][''])) $sel_options['#'.$name][''] = lang('Select one');

View File

@ -262,6 +262,12 @@ class etemplate_widget_customfields extends etemplate_widget_transformer
$widget->attrs['only_app'] = $field['type'];
break;
case 'text':
break;
default:
if (substr($type, 0, 7) !== 'select-') break;
// fall-through for all select-* widgets
case 'select':
$this->attrs['multiple'] = $field['rows'] > 1;
// fall through
@ -270,7 +276,15 @@ class etemplate_widget_customfields extends etemplate_widget_transformer
{
$field['values'] = self::_get_options_from_file($field['values']['@']);
}
// keep extra values set by app code, eg. addressbook advanced search
if (is_array(self::$request->sel_options[self::$prefix.$fname]))
{
self::$request->sel_options[self::$prefix.$fname] += (array)$field['values'];
}
else
{
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]));
break;
}

View File

@ -370,7 +370,7 @@ var et2_selectAccount = et2_selectbox.extend(
}
else
{
this.options.select_options.push({value: key, label: options});
this.options.select_options.push({value: key, label: options[key]});
}
}
}