mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-05 13:39:23 +01:00
fix for search to return also the entries from sub-categoris, as sugested by Stephan Hilchenbach from the german list
This commit is contained in:
parent
f68cd32ede
commit
4b7ced6e84
@ -72,7 +72,21 @@
|
|||||||
{
|
{
|
||||||
$extra = '';
|
$extra = '';
|
||||||
$extra .= (strpos($this->filter,'private')?'AND phpgw_cal.is_public=0 ':'');
|
$extra .= (strpos($this->filter,'private')?'AND phpgw_cal.is_public=0 ':'');
|
||||||
$extra .= ($this->cat_id?"AND phpgw_cal.category like '%".$this->cat_id."%' ":'');
|
//$extra .= ($this->cat_id?"AND phpgw_cal.category like '%".$this->cat_id."%' ":'');
|
||||||
|
if ($this->cat_id)
|
||||||
|
{
|
||||||
|
if (!is_object($GLOBALS['phpgw']->categories))
|
||||||
|
{
|
||||||
|
$GLOBALS['phpgw']->categories = CreateObject('phpgwapi.categories');
|
||||||
|
}
|
||||||
|
$cats = $GLOBALS['phpgw']->categories->return_all_children($this->cat_id);
|
||||||
|
$extra .= "AND (phpgw_cal.category".(count($cats) > 1 ? ' IN ('.implode(',',$cats).')' : '='.(int)$this->cat_id);
|
||||||
|
foreach($cats as $cat)
|
||||||
|
{
|
||||||
|
$extra .= " OR phpgw_cal.category LIKE '$cat,%' OR phpgw_cal.category LIKE '%,$cat,%' OR phpgw_cal.category LIKE '%,$cat'";
|
||||||
|
}
|
||||||
|
$extra .= ') ';
|
||||||
|
}
|
||||||
if($owner_id)
|
if($owner_id)
|
||||||
{
|
{
|
||||||
return $this->cal->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay,$extra,$GLOBALS['phpgw']->datetime->tz_offset,$owner_id);
|
return $this->cal->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay,$extra,$GLOBALS['phpgw']->datetime->tz_offset,$owner_id);
|
||||||
|
@ -518,9 +518,15 @@
|
|||||||
}
|
}
|
||||||
//echo "<p>filtermethod='$filtermethod'</p>";
|
//echo "<p>filtermethod='$filtermethod'</p>";
|
||||||
|
|
||||||
if (intval($query['cat_id']))
|
if ((int)$query['cat_id'])
|
||||||
{
|
{
|
||||||
$filtermethod .= ' AND info_cat='.intval($query['cat_id']).' ';
|
//$filtermethod .= ' AND info_cat='.intval($query['cat_id']).' ';
|
||||||
|
if (!is_object($GLOBALS['phpgw']->categories))
|
||||||
|
{
|
||||||
|
$GLOBALS['phpgw']->categories = CreateObject('phpgwapi.categories');
|
||||||
|
}
|
||||||
|
$cats = $GLOBALS['phpgw']->categories->return_all_children((int)$query['cat_id']);
|
||||||
|
$filtermethod .= ' AND info_cat'.(count($cats)>1? ' IN ('.implode(',',$cats).') ' : '='.(int)$query['cat_id']);
|
||||||
}
|
}
|
||||||
$join = '';
|
$join = '';
|
||||||
if ($query['query']) $query['search'] = $query['query']; // allow both names
|
if ($query['query']) $query['search'] = $query['query']; // allow both names
|
||||||
|
@ -348,7 +348,21 @@
|
|||||||
{
|
{
|
||||||
if($name == 'cat_id')
|
if($name == 'cat_id')
|
||||||
{
|
{
|
||||||
$filterlist[] = "(" . $name . " LIKE '%," . (int)$value . ",%' OR " . $name."='".(int)$value."')";
|
if (!(int)$value) continue; // nothing to filter
|
||||||
|
|
||||||
|
//$filterlist[] = "(" . $name . " LIKE '%," . (int)$value . ",%' OR " . $name."='".(int)$value."')";
|
||||||
|
if (!is_object($GLOBALS['phpgw']->categories))
|
||||||
|
{
|
||||||
|
$GLOBALS['phpgw']->categories = CreateObject('phpgwapi.categories');
|
||||||
|
}
|
||||||
|
$cats = $GLOBALS['phpgw']->categories->return_all_children((int)$value);
|
||||||
|
$cat_filter = '(cat_id IN ('.implode(',',$cats).')';
|
||||||
|
foreach($cats as $cat)
|
||||||
|
{
|
||||||
|
$cat_filter .= " OR cat_id LIKE '%,$cat,%'";
|
||||||
|
}
|
||||||
|
$cat_filter .= ')';
|
||||||
|
$filterlist[] = $cat_filter;
|
||||||
}
|
}
|
||||||
elseif(@is_int($value))
|
elseif(@is_int($value))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user