mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 19:03:14 +01:00
Improve find_event()
This commit is contained in:
parent
6f68c0a41b
commit
1162445002
@ -1482,8 +1482,6 @@ class calendar_boupdate extends calendar_bo
|
|||||||
|
|
||||||
if ($filter == 'master')
|
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[] = 'recur_type!='. MCAL_RECUR_NONE;
|
||||||
$query['cal_recurrence'] = 0;
|
$query['cal_recurrence'] = 0;
|
||||||
}
|
}
|
||||||
@ -1535,6 +1533,9 @@ class calendar_boupdate extends calendar_bo
|
|||||||
}
|
}
|
||||||
unset($event['id']);
|
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
|
// only query calendars of users, we have READ-grants from
|
||||||
$users = array();
|
$users = array();
|
||||||
foreach(array_keys($this->grants) as $user)
|
foreach(array_keys($this->grants) as $user)
|
||||||
@ -1623,7 +1624,15 @@ class calendar_boupdate extends calendar_bo
|
|||||||
$query[] = ('cal_start<' . ($event['start'] + 2));
|
$query[] = ('cal_start<' . ($event['start'] + 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$matchFields = array('priority', 'public', 'non_blocking', 'recurrence');
|
if ($filter == 'relax')
|
||||||
|
{
|
||||||
|
$matchFields = array();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$matchFields = array('priority', 'public', 'non_blocking');
|
||||||
|
}
|
||||||
|
$matchFields[] = 'recurrence';
|
||||||
foreach ($matchFields as $key)
|
foreach ($matchFields as $key)
|
||||||
{
|
{
|
||||||
if (isset($event[$key])) $query['cal_'.$key] = $event[$key];
|
if (isset($event[$key])) $query['cal_'.$key] = $event[$key];
|
||||||
@ -1700,7 +1709,7 @@ class calendar_boupdate extends calendar_bo
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($event['uid']) && $filter == 'exact') break;
|
if (!empty($event['uid']) && $filter == 'exact' || $filter == 'master') break;
|
||||||
|
|
||||||
// check times
|
// check times
|
||||||
if ($filter != 'relax')
|
if ($filter != 'relax')
|
||||||
@ -1717,7 +1726,7 @@ class calendar_boupdate extends calendar_bo
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($filter != 'master')
|
else
|
||||||
{
|
{
|
||||||
if (abs($event['end'] - $egwEvent['end']) >= 120)
|
if (abs($event['end'] - $egwEvent['end']) >= 120)
|
||||||
{
|
{
|
||||||
@ -1732,15 +1741,10 @@ class calendar_boupdate extends calendar_bo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check for real match
|
// check for real match
|
||||||
$matchFields = array('title');
|
$matchFields = array('title', 'description');
|
||||||
switch ($filter)
|
if ($filter != 'relax')
|
||||||
{
|
{
|
||||||
case 'master':
|
|
||||||
break;
|
|
||||||
case 'relax':
|
|
||||||
$matchFields[] = 'location';
|
$matchFields[] = 'location';
|
||||||
default:
|
|
||||||
$matchFields[] = 'description';
|
|
||||||
}
|
}
|
||||||
foreach ($matchFields as $key)
|
foreach ($matchFields as $key)
|
||||||
{
|
{
|
||||||
@ -1751,13 +1755,13 @@ class calendar_boupdate extends calendar_bo
|
|||||||
{
|
{
|
||||||
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
|
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
|
||||||
"() event[$key] differ: '" . $event[$key] .
|
"() event[$key] differ: '" . $event[$key] .
|
||||||
"' <> '" . $egwEvent[$key]) . "'";
|
"' <> '" . $egwEvent[$key] . "'");
|
||||||
}
|
}
|
||||||
continue 2; // next foundEvent
|
continue 2; // next foundEvent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($filter != 'master' && is_array($event['category']))
|
if (is_array($event['category']))
|
||||||
{
|
{
|
||||||
// check categories
|
// check categories
|
||||||
$egwCategories = explode(',', $egwEvent['category']);
|
$egwCategories = explode(',', $egwEvent['category']);
|
||||||
@ -1786,7 +1790,7 @@ class calendar_boupdate extends calendar_bo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($filter != 'relax' && $filter != 'master')
|
if ($filter != 'relax')
|
||||||
{
|
{
|
||||||
// check participants
|
// check participants
|
||||||
if (is_array($event['participants']))
|
if (is_array($event['participants']))
|
||||||
@ -1824,8 +1828,6 @@ class calendar_boupdate extends calendar_bo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($filter != 'master')
|
|
||||||
{
|
|
||||||
if ($event['recur_type'] == MCAL_RECUR_NONE)
|
if ($event['recur_type'] == MCAL_RECUR_NONE)
|
||||||
{
|
{
|
||||||
if ($egwEvent['recur_type'] != MCAL_RECUR_NONE)
|
if ($egwEvent['recur_type'] != MCAL_RECUR_NONE)
|
||||||
@ -1886,9 +1888,7 @@ class calendar_boupdate extends calendar_bo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$matchingEvents[] = $egwEvent['id']; // exact match
|
$matchingEvents[] = $egwEvent['id']; // exact match
|
||||||
if ($filter = 'master') break;
|
|
||||||
}
|
}
|
||||||
// append pseudos as last entries
|
// append pseudos as last entries
|
||||||
$matchingEvents = array_merge($matchingEvents, $pseudos);
|
$matchingEvents = array_merge($matchingEvents, $pseudos);
|
||||||
|
Loading…
Reference in New Issue
Block a user