fixing the fix: now cat_id=1 got not lost with a 2nd default option set in addressbook (0=None)

This commit is contained in:
Ralf Becker 2014-09-09 14:12:07 +00:00
parent 757d0e9c38
commit 1125c3f52c
3 changed files with 6 additions and 7 deletions

View File

@ -244,7 +244,7 @@ class addressbook_ui extends addressbook_bo
$content['nm'] = array_merge($content['nm'],$state);
}
}
$sel_options['cat_id'] = array(array('value' => '', 'label' => lang('all')), array('value' => 0, 'label'=>lang('None')));
$sel_options['cat_id'] = array('' => lang('all'), '0' => lang('None'));
// Delete list action depends on permissions
if($this->get_lists(EGW_ACL_EDIT))

View File

@ -202,7 +202,7 @@ class etemplate_widget_menupopup extends etemplate_widget
if($this->attrs['type'] == 'select-account' && !$GLOBALS['egw_info']['user']['apps']['admin'] && $select_pref == 'none')
{
self::$request->preserv[$this->id] = self::$request->content[$this->id];
unset(self::$request->content[$this->id]);
unset(self::$request->content[$this->id]);
$this->attrs['readonly'] = true;
}
@ -256,12 +256,12 @@ class etemplate_widget_menupopup extends etemplate_widget
// either uses the same ID in the template, or adds the options twice
if(is_numeric($value) && (!is_array($label) || is_array($label) && !array_key_exists('value',$label)))
{
$check_value = is_array($label) && array_key_exists('value', $label) ? $label['value'] : $value;
if($value == $check_value)
$check_value = (string)(is_array($label) && array_key_exists('value', $label) ? $label['value'] : $value);
if((string)$value === $check_value)
{
foreach($options as $key => $existing)
{
if(is_array($existing) && $existing['value'] == $check_value && $key != $value)
if(is_array($existing) && isset($existing['value']) && (string)$existing['value'] === $check_value && $key != $value)
{
unset($options[$value]);
continue 2;

View File

@ -188,8 +188,7 @@ class etemplate_widget_nextmatch extends etemplate_widget
{
$value['options-cat_id'][''] = lang('all');
}
$value['options-cat_id'] = array_merge($value['options-cat_id'],
etemplate_widget_menupopup::typeOptions('select-cat', ',,'.$cat_app,$no_lang,false,$value['cat_id']));
$value['options-cat_id'] += etemplate_widget_menupopup::typeOptions('select-cat', ',,'.$cat_app,$no_lang,false,$value['cat_id']);
etemplate_widget_menupopup::fix_encoded_options($value['options-cat_id']);
}