fix for bug [ 1106014 ] Problems with recurring events (several bugs)

This commit is contained in:
Ralf Becker 2005-02-10 00:13:37 +00:00
parent c6aa4719ef
commit 67ed35e6ea
4 changed files with 52 additions and 17 deletions

View File

@ -243,30 +243,32 @@ class bocal
if(count($event_ids) || count($rep_event_ids))
{
//foreach($event_ids+$rep_event_ids as $id)
foreach((array) $this->read($event_ids+$rep_event_ids,true) as $id => $event)
$db_events = (array) $this->read($event_ids+$rep_event_ids,true);
foreach($db_events as $id => $event)
{
//$event = $this->read($id,True); // = no ACL check, as other entries dont get reported !!!
if ($event['recur_type']) continue; // done in 2. step, we need the exceptions first
// recuring events are handled later, remember them for later use, no new read necessary
if ($event['recur_type'])
{
$this->insert_all_repetitions($event,$start,$end,$events,$recur_exceptions[$id]);
$events_sorted = False;
continue;
}
// recur-exceptions have a reference to the original event
// we remember they are their for a certain date and id, to not insert their regular recurrence
if ($event['reference'])
{
for($ts = $event['start']['raw']; $ts < $event['end']['raw']; $ts += DAY_s)
{
$recur_exceptions[$event['reference']][(int)$this->date2string($ts)] = True;
$recur_exceptions[$event['reference']][(int)$this->date2string((int)$ts)] = True;
}
$recur_exceptions[$event['reference']][$event['end']['full']] = True;
}
$events[] = $event;
$events[] = &$db_events[$id];
unset($db_events[$id]);
}
foreach($db_events as $id => $event)
{
$this->insert_all_repetitions($event,$start,$end,$events,$recur_exceptions[$id]);
$events_sorted = False;
}
unset($db_events);
if ($this->debug && ($this->debug > 2 || $this->debug == 'search'))
{
$this->debug_message('socalendar::search processed event_ids=%1, events=%2',False,$event_ids+$rep_event_ids,$events);
@ -411,10 +413,18 @@ class bocal
$search_date_ymd = (int)$this->date2string($ts);
$have_exception = !is_null($recur_exceptions) && isset($recur_exceptions[$search_date_ymd]);
if (!$have_exception) // no execption by an edited event => check the deleted ones
{
foreach($event['recur_exception'] as $exception_ts)
{
$have_exception = $search_date_ymd == (int)$this->date2string($exception_ts);
}
}
if ($this->debug && ($this->debug > 3 || $this->debug == 'insert_all_repetions'))
{
$this->debug_message('bocal::insert_all_repetions(...,%1) checking recur_exceptions[%2]=%3',False,
$recur_exceptions,$search_date_ymd,$have_exception);
$this->debug_message('bocal::insert_all_repetions(...,%1) checking recur_exceptions[%2] and event[recur_exceptions]=%3 ==> %4',False,
$recur_exceptions,$search_date_ymd,$event['recur_exception'],$have_exception);
}
if ($have_exception)
{

View File

@ -12,7 +12,7 @@
/* $Id$ */
$setup_info['calendar']['name'] = 'calendar';
$setup_info['calendar']['version'] = '1.0.0.004';
$setup_info['calendar']['version'] = '1.0.0.005';
$setup_info['calendar']['app_order'] = 3;
$setup_info['calendar']['enable'] = 1;
@ -62,3 +62,4 @@

View File

@ -61,9 +61,9 @@
'recur_data' => array('type' => 'int','precision' => '8','default' => '1'),
'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '')
),
'pk' => array(),
'pk' => array('cal_id'),
'fk' => array(),
'ix' => array('cal_id'),
'ix' => array(),
'uc' => array()
),
'phpgw_cal_user' => array(

View File

@ -1135,4 +1135,28 @@
$GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.004';
return $GLOBALS['setup_info']['calendar']['currentver'];
}
$test[] = '1.0.0.004';
function calendar_upgrade1_0_0_004()
{
$GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array(
'fd' => array(
'cal_id' => array('type' => 'int','precision' => '8','nullable' => False),
'recur_type' => array('type' => 'int','precision' => '8','nullable' => False),
'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'),
'recur_enddate' => array('type' => 'int','precision' => '8'),
'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'),
'recur_data' => array('type' => 'int','precision' => '8','default' => '1'),
'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '')
),
'pk' => array('cal_id'),
'fk' => array(),
'ix' => array(),
'uc' => array()
));
$GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.005';
return $GLOBALS['setup_info']['calendar']['currentver'];
}
?>