Add check for automatic 'All' option to avoid extra 'All' options when app stores category options in session.

This commit is contained in:
Nathan Gray 2014-03-03 17:53:27 +00:00
parent e5b1c65045
commit f561e7e7bf

View File

@ -174,7 +174,14 @@ class etemplate_widget_nextmatch extends etemplate_widget
if(!$value['no_cat'] && !$value['cat_is_select']) if(!$value['no_cat'] && !$value['cat_is_select'])
{ {
$cat_app = $value['cat_app'] ? $value['cat_app'] : $GLOBALS['egw_info']['flags']['current_app']; $cat_app = $value['cat_app'] ? $value['cat_app'] : $GLOBALS['egw_info']['flags']['current_app'];
$value['options-cat_id'] = array('' => lang('all')) + $value['options-cat_id'] = array();
// Add 'All', if not already there
if(!$value['options-cat_id'][''] && !($value['options-cat_id'][0] && $value['options-cat_id'][0]['value'] == ''))
{
$value['options-cat_id'][''] = lang('all');
}
$value['options-cat_id'] +=
etemplate_widget_menupopup::typeOptions('select-cat', ',,'.$cat_app,$no_lang,false,$value['cat_id']) + etemplate_widget_menupopup::typeOptions('select-cat', ',,'.$cat_app,$no_lang,false,$value['cat_id']) +
(array)$value['options-cat_id']; (array)$value['options-cat_id'];
etemplate_widget_menupopup::fix_encoded_options($value['options-cat_id']); etemplate_widget_menupopup::fix_encoded_options($value['options-cat_id']);