mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-22 13:58:40 +01:00
Improve find_event()
This commit is contained in:
parent
f87c13704e
commit
3f108b9144
@ -1196,8 +1196,6 @@ class calendar_boupdate extends calendar_bo
|
||||
|
||||
if ($filter == 'master')
|
||||
{
|
||||
// No chance to find a master without [U]ID
|
||||
if (emtpy($event['uid']) && empty($event['id'])) return $matchingEvents;
|
||||
$query[] = 'recur_type!='. MCAL_RECUR_NONE;
|
||||
$query['cal_reference'] = 0;
|
||||
}
|
||||
@ -1249,6 +1247,9 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
unset($event['id']);
|
||||
|
||||
// No chance to find a master without [U]ID
|
||||
if ($filter == 'master' && empty($event['uid'])) return $matchingEvents;
|
||||
|
||||
// only query calendars of users, we have READ-grants from
|
||||
$users = array();
|
||||
foreach(array_keys($this->grants) as $user)
|
||||
@ -1336,7 +1337,15 @@ class calendar_boupdate extends calendar_bo
|
||||
$query[] = ('cal_start<' . ($event['start'] + 2));
|
||||
}
|
||||
}
|
||||
$matchFields = array('priority', 'public', 'non_blocking', 'reference');
|
||||
if ($filter == 'relax')
|
||||
{
|
||||
$matchFields = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$matchFields = array('priority', 'public', 'non_blocking');
|
||||
}
|
||||
$matchFields[] = 'reference';
|
||||
foreach ($matchFields as $key)
|
||||
{
|
||||
if (isset($event[$key])) $query['cal_'.$key] = $event[$key];
|
||||
@ -1407,7 +1416,7 @@ class calendar_boupdate extends calendar_bo
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty($event['uid']) && $filter == 'exact') break;
|
||||
if (!empty($event['uid']) && $filter == 'exact' || $filter == 'master') break;
|
||||
|
||||
// check times
|
||||
if ($filter != 'relax')
|
||||
@ -1424,7 +1433,7 @@ class calendar_boupdate extends calendar_bo
|
||||
continue;
|
||||
}
|
||||
}
|
||||
elseif ($filter != 'master')
|
||||
else
|
||||
{
|
||||
if (abs($event['end'] - $egwEvent['end']) >= 120)
|
||||
{
|
||||
@ -1439,15 +1448,10 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
|
||||
// check for real match
|
||||
$matchFields = array('title');
|
||||
switch ($filter)
|
||||
$matchFields = array('title', 'description');
|
||||
if ($filter != 'relax')
|
||||
{
|
||||
case 'master':
|
||||
break;
|
||||
case 'relax':
|
||||
$matchFields[] = 'location';
|
||||
default:
|
||||
$matchFields[] = 'description';
|
||||
}
|
||||
foreach ($matchFields as $key)
|
||||
{
|
||||
@ -1464,7 +1468,7 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
}
|
||||
|
||||
if ($filter != 'master' && is_array($event['category']))
|
||||
if (is_array($event['category']))
|
||||
{
|
||||
// check categories
|
||||
$egwCategories = explode(',', $egwEvent['category']);
|
||||
@ -1493,7 +1497,7 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
}
|
||||
|
||||
if ($filter != 'relax' && $filter != 'master')
|
||||
if ($filter != 'relax')
|
||||
{
|
||||
// check participants
|
||||
if (is_array($event['participants']))
|
||||
@ -1531,8 +1535,6 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
}
|
||||
|
||||
if ($filter != 'master')
|
||||
{
|
||||
if ($event['recur_type'] == MCAL_RECUR_NONE)
|
||||
{
|
||||
if ($egwEvent['recur_type'] != MCAL_RECUR_NONE)
|
||||
@ -1595,9 +1597,7 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$matchingEvents[] = $egwEvent['id']; // exact match
|
||||
if ($filter = 'master') break;
|
||||
}
|
||||
// append pseudos as last entries
|
||||
$matchingEvents = array_merge($matchingEvents, $pseudos);
|
||||
|
Loading…
Reference in New Issue
Block a user