fix for reset_stati on Drag and Drop; Work by Chr.Fueller, leithoff

This commit is contained in:
Klaus Leithoff 2010-07-13 14:36:51 +00:00
parent b82cdbcdd7
commit a63134dd5f

View File

@ -44,11 +44,30 @@ class calendar_ajax {
return false;
}
$event=$this->calendar->read($eventId);
$old_event=$event=$this->calendar->read($eventId);
$duration=$event['end']-$event['start'];
$event['start'] = $this->calendar->date2ts($targetDateTime);
$event['end'] = $event['start']+$duration;
$status_reset_to_unknown = false;
switch ($this->calendar->cal_prefs['reset_stati'])
{
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)
{
//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')
{
$event['participants'][$uid] = calendar_so::combine_status('U',$q,$r);
}
}
}
$conflicts=$this->calendar->update($event);
@ -69,6 +88,18 @@ class calendar_ajax {
.'&cancel_needs_refresh=true',
'',750,410);
}
if ($status_reset_to_unknown)
{
foreach((array)$event['participants'] as $uid => $status)
{
if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->calendar->user)
{
calendar_so::split_status($status,$q,$r);
$status = calendar_so::combine_status('U',$q,$r);
$this->calendar->set_status($event['id'], $uid, $status, 0, true);
}
}
}
return $response->getXML();
}