* Calendar: Added category filter for events without a category set

This commit is contained in:
nathan 2023-07-10 15:58:04 -06:00
parent 23f0b6faaf
commit e9038d2f34
2 changed files with 23 additions and 13 deletions

View File

@ -623,7 +623,12 @@ class calendar_so
function cat_filter($cat_id)
{
$sql = '';
if ($cat_id)
// No category
if($cat_id === false || $cat_id && ($cat_id == ["0"] || !(int)$cat_id))
{
$sql = 'cal_category=""';
}
elseif($cat_id)
{
$cats = $GLOBALS['egw']->categories->return_all_children($cat_id);
array_walk($cats, function (&$val, $key)
@ -631,7 +636,10 @@ class calendar_so
unset($key); // not used, but required by function signature
$val = (int)$val;
});
if (is_array($cat_id) && count($cat_id)==1) $cat_id = $cat_id[0];
if(is_array($cat_id) && count($cat_id) == 1)
{
$cat_id = $cat_id[0];
}
$sql = '(cal_category' . (count($cats) > 1 ? " IN ('" . implode("','", $cats) . "')" : '=' . $this->db->quote((int)$cat_id));
foreach($cats as $cat)
{

View File

@ -18,7 +18,9 @@ Egroupware
<et2-textbox type="hidden" id="first"></et2-textbox>
<et2-textbox type="hidden" id="last"></et2-textbox>
<hrule/>
<et2-select-cat id="cat_id" placeholder="All categories" onchange="app.calendar.update_state({cat_id: widget.getValue()});" emptyLabel="All categories" multiple="true"></et2-select-cat>
<et2-select-cat id="cat_id" placeholder="All categories" onchange="app.calendar.update_state({cat_id: widget.getValue()});" emptyLabel="All categories" multiple="true">
<option value="0">None</option>
</et2-select-cat>
<et2-select id="status_filter" onchange="app.calendar.update_state({status_filter: widget.getValue()});" noLang="true"></et2-select>
<hrule/>
<et2-calendar-owner id="owner" onchange="app.calendar.update_state({owner: widget.getValue()}); return false;" multiple="true" allowFreeEntries="false" autocompleteParams="{&quot;checkgrants&quot;: true}"/>