* Calendar: Use participant's preferences to handle status resets while moving events

This commit is contained in:
Jörg Lehrke 2010-11-02 11:00:41 +00:00
parent 8b5ff32c53
commit fbbef0c68c
2 changed files with 31 additions and 25 deletions

View File

@ -50,23 +50,26 @@ class calendar_ajax {
$event['start'] = $this->calendar->date2ts($targetDateTime);
$event['end'] = $event['start']+$duration;
$status_reset_to_unknown = false;
switch ($this->calendar->cal_prefs['reset_stati'])
$sameday = (date('Ymd', $old_event['start']) == date('Ymd', $event['start']));
foreach((array)$event['participants'] as $uid => $status)
{
case 'no':
break;
case 'startday':
if (date('Ymd', $old_event['start']) == date('Ymd', $event['start'])) break;
default:
$status_reset_to_unknown = true;
foreach((array)$event['participants'] as $uid => $status)
calendar_so::split_status($status,$q,$r);
if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->calendar->user && $status != 'U')
{
$preferences = CreateObject('phpgwapi.preferences',$uid);
$part_prefs = $preferences->read_repository();
switch ($part_prefs['calendar']['reset_stati'])
{
//error_log("participant {$GLOBALS['egw']->accounts->id2name($uid)} ($status)");
calendar_so::split_status($status,$q,$r);
if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->calendar->user && $status != 'U')
{
case 'no':
break;
case 'startday':
if ($sameday) break;
default:
$status_reset_to_unknown = true;
$event['participants'][$uid] = calendar_so::combine_status('U',$q,$r);
}
// todo: report reset status to user
}
}
}
$conflicts=$this->calendar->update($event);

View File

@ -641,23 +641,26 @@ class calendar_uiforms extends calendar_ui
$old_event['end'] != $event['end'] ||
$event['whole_day'] != $old_event['whole_day'])
{
switch ($this->bo->cal_prefs['reset_stati'])
$sameday = (date('Ymd', $old_event['start']) == date('Ymd', $event['start']));
foreach((array)$event['participants'] as $uid => $status)
{
case 'no':
break;
case 'startday':
if (date('Ymd', $old_event['start']) == date('Ymd', $event['start'])) break;
default:
$status_reset_to_unknown = true;
foreach((array)$event['participants'] as $uid => $status)
calendar_so::split_status($status,$q,$r);
if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->bo->user && $status != 'U')
{
$preferences = CreateObject('phpgwapi.preferences',$uid);
$part_prefs = $preferences->read_repository();
switch ($part_prefs['calendar']['reset_stati'])
{
calendar_so::split_status($status,$q,$r);
if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->bo->user && $status != 'U')
{
case 'no':
break;
case 'startday':
if ($sameday) break;
default:
$status_reset_to_unknown = true;
$event['participants'][$uid] = calendar_so::combine_status('U',$q,$r);
// todo: report reset status to user
}
}
}
}
}
}