allways update modified TS and modifier in save(), removed code to only conditionally update in update()

fixes bug that ctag got not updated when eg. a recurrence got deleted
This commit is contained in:
Ralf Becker 2011-04-07 08:01:48 +00:00
parent c443126893
commit f4e372747a

View File

@ -93,7 +93,7 @@ class calendar_boupdate extends calendar_bo
*
* @param array &$event event-array, on return some values might be changed due to set defaults
* @param boolean $ignore_conflicts=false just ignore conflicts or do a conflict check and return the conflicting events
* @param boolean $touch_modified=true touch modificatin time and set modifing user, default true=yes
* @param boolean $touch_modified=true NOT USED ANYMORE (was only used in old csv-import), modified&modifier is always updated!
* @param boolean $ignore_acl=false should we ignore the acl
* @param boolean $updateTS=true update the content history of the event
* @param array &$messages=null messages about because of missing ACL removed participants or categories
@ -154,8 +154,6 @@ class calendar_boupdate extends calendar_bo
}
if ($new_event)
{
$event['created'] = $this->now_su;
$event['creator'] = $this->user;
$old_event = array();
}
else
@ -349,12 +347,6 @@ class calendar_boupdate extends calendar_bo
}
}
// save the event to the database
if ($touch_modified)
{
$event['modified'] = $this->now_su; // we are still in user-time
$event['modifier'] = $this->user;
}
//echo "saving $event[id]="; _debug_array($event);
$event2save = $event;
@ -875,7 +867,7 @@ class calendar_boupdate extends calendar_bo
*/
function save($event,$ignore_acl=false,$updateTS=true)
{
//error_log(__METHOD__.'('.array2string($event).",$etag)");
//error_log(__METHOD__.'('.array2string($event).", $ignore_acl, $updateTS)");
// check if user has the permission to update / create the event
if (!$ignore_acl && ($event['id'] && !$this->check_perms(EGW_ACL_EDIT,$event['id']) ||
@ -982,11 +974,11 @@ class calendar_boupdate extends calendar_bo
$this->so->save_alarm($event['id'],$alarm, $this->now);
}
}
if (!isset($event['modified']) || $event['modified'] > $this->now)
{
$event['modified'] = $this->now;
$event['modifier'] = $this->user;
}
// always update modification time (ctag depends on it!)
$event['modified'] = $this->now;
$event['modifier'] = $this->user;
if (empty($event['id']) && (!isset($event['created']) || $event['created'] > $this->now))
{
$event['created'] = $this->now;
@ -1298,7 +1290,7 @@ class calendar_boupdate extends calendar_bo
// mark all links to the event as deleted, but keep them
egw_link::unlink(0,'calendar',$cal_id,'','','',true);
$event['modified'] = $event['deleted'] = $this->now;
$event['deleted'] = $this->now;
$this->save($event, $ignore_acl);
// Actually delete alarms
if (isset($event['alarm']) && is_array($event['alarm']))
@ -1311,7 +1303,7 @@ class calendar_boupdate extends calendar_bo
}
$GLOBALS['egw']->contenthistory->updateTimeStamp('calendar', $cal_id, 'delete', $this->now);
}
else
else // delete an exception
{
$event['recur_exception'][] = $recur_date = $this->date2ts($event['start']);
unset($event['start']);