mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-01 10:59:35 +01:00
Improved search for pseudo exceptions
This commit is contained in:
parent
8368344f0f
commit
9e0f73f0dc
@ -176,7 +176,7 @@ class calendar_bo
|
|||||||
*/
|
*/
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
if ($this->debug > 0) $this->debug_message('bocal::bocal() started',True,$param);
|
if ($this->debug > 0) $this->debug_message('bocal::bocal() started',true);
|
||||||
|
|
||||||
$this->so = new calendar_so();
|
$this->so = new calendar_so();
|
||||||
$this->datetime = $GLOBALS['egw']->datetime;
|
$this->datetime = $GLOBALS['egw']->datetime;
|
||||||
|
@ -1187,7 +1187,6 @@ class calendar_boupdate extends calendar_bo
|
|||||||
{
|
{
|
||||||
$matchingEvents = array();
|
$matchingEvents = array();
|
||||||
$query = array();
|
$query = array();
|
||||||
$recur_date = 0;
|
|
||||||
|
|
||||||
if ($this->log)
|
if ($this->log)
|
||||||
{
|
{
|
||||||
@ -1197,14 +1196,6 @@ class calendar_boupdate extends calendar_bo
|
|||||||
|
|
||||||
if ($filter == 'master')
|
if ($filter == 'master')
|
||||||
{
|
{
|
||||||
if (isset($event['reference']))
|
|
||||||
{
|
|
||||||
$recur_date = $event['reference'];
|
|
||||||
}
|
|
||||||
elseif (isset($event['start']))
|
|
||||||
{
|
|
||||||
$recur_date = $event['start'];
|
|
||||||
}
|
|
||||||
$query[] = 'recur_type!='. MCAL_RECUR_NONE;
|
$query[] = 'recur_type!='. MCAL_RECUR_NONE;
|
||||||
$query['cal_reference'] = 0;
|
$query['cal_reference'] = 0;
|
||||||
}
|
}
|
||||||
@ -1218,29 +1209,41 @@ class calendar_boupdate extends calendar_bo
|
|||||||
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
|
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
|
||||||
'(' . $event['id'] . ")[EventID]");
|
'(' . $event['id'] . ")[EventID]");
|
||||||
}
|
}
|
||||||
if (($egwEvent = $this->read($event['id'], $recur_date, false, 'server')))
|
if (($egwEvent = $this->read($event['id'], 0, false, 'server')))
|
||||||
{
|
{
|
||||||
if ($this->log)
|
if ($this->log)
|
||||||
{
|
{
|
||||||
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
|
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
|
||||||
'()[FOUND]:' . array2string($egwEvent));
|
'()[FOUND]:' . array2string($egwEvent));
|
||||||
}
|
}
|
||||||
// Just a simple consistency check
|
if ($egwEvent['recur_type'] != MCAL_RECUR_NONE &&
|
||||||
if ($filter == 'exact' ||
|
(empty($event['uid']) || $event['uid'] == $egwEvent['uid']))
|
||||||
$filter == 'master' && $egwEvent['recur_type'] != MCAL_RECUR_NONE ||
|
|
||||||
$filter != 'master' && strpos($egwEvent['title'], $event['title']) === 0)
|
|
||||||
{
|
{
|
||||||
$retval = $egwEvent['id'];
|
if ($filter == 'master')
|
||||||
if ($egwEvent['recur_type'] != MCAL_RECUR_NONE &&
|
|
||||||
$event['recur_type'] == MCAL_RECUR_NONE && $event['reference'] != 0)
|
|
||||||
{
|
{
|
||||||
$retval .= ':' . (int)$event['reference'];
|
$matchingEvents[] = $egwEvent['id']; // we found the master
|
||||||
}
|
}
|
||||||
$matchingEvents[] = $retval;
|
if ($event['recur_type'] == $egwEvent['recur_type'])
|
||||||
return $matchingEvents;
|
{
|
||||||
|
$matchingEvents[] = $egwEvent['id']; // we found the event
|
||||||
|
}
|
||||||
|
elseif ($event['recur_type'] == MCAL_RECUR_NONE &&
|
||||||
|
$event['reference'] != 0)
|
||||||
|
{
|
||||||
|
$exceptions = $this->so->get_recurrence_exceptions($egwEvent);
|
||||||
|
if (in_array($event['reference'], $exceptions))
|
||||||
|
{
|
||||||
|
$matchingEvents[] = $egwEvent['id'] . ':' . (int)$event['reference'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif ($event['recur_type'] == $egwEvent['recur_type'] &&
|
||||||
|
$filter != 'master' &&
|
||||||
|
strpos($egwEvent['title'], $event['title']) === 0)
|
||||||
|
{
|
||||||
|
$matchingEvents[] = $egwEvent['id']; // we found the event
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($filter == 'exact') return array();
|
if (!empty($matchingEvents) || $filter == 'exact') return $matchingEvents;
|
||||||
}
|
}
|
||||||
unset($event['id']);
|
unset($event['id']);
|
||||||
|
|
||||||
@ -1382,7 +1385,7 @@ class calendar_boupdate extends calendar_bo
|
|||||||
$matchingEvents[] = $egwEvent['id'];
|
$matchingEvents[] = $egwEvent['id'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!$egwEvent['reference'])
|
if (!$egwEvent['reference'] && $event['reference'])
|
||||||
{
|
{
|
||||||
// We found the master
|
// We found the master
|
||||||
if ($filter == 'master')
|
if ($filter == 'master')
|
||||||
@ -1390,8 +1393,8 @@ class calendar_boupdate extends calendar_bo
|
|||||||
$matchingEvents[] = $egwEvent['id'];
|
$matchingEvents[] = $egwEvent['id'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (($egwEvent = $this->read($egwEvent['id'], $event['reference'], false, 'server'))
|
$exceptions = $this->so->get_recurrence_exceptions($egwEvent);
|
||||||
&& $egwEvent['reference'] == $event['reference'])
|
if (in_array($event['reference'], $exceptions))
|
||||||
{
|
{
|
||||||
// We found a pseudo exception
|
// We found a pseudo exception
|
||||||
$matchingEvents[] = $egwEvent['id'] . ':' . (int)$event['reference'];
|
$matchingEvents[] = $egwEvent['id'] . ':' . (int)$event['reference'];
|
||||||
@ -1401,6 +1404,8 @@ class calendar_boupdate extends calendar_bo
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($event['uid']) && $filter == 'exact') beak;
|
||||||
|
|
||||||
// check times
|
// check times
|
||||||
if ($filter != 'relax')
|
if ($filter != 'relax')
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user