diff --git a/calendar/inc/class.calendar_bo.inc.php b/calendar/inc/class.calendar_bo.inc.php index f20e56d0bf..b6d7d7945f 100644 --- a/calendar/inc/class.calendar_bo.inc.php +++ b/calendar/inc/class.calendar_bo.inc.php @@ -410,7 +410,7 @@ class calendar_bo } return $contact_list; } - + /** * Add group-members as participants with status 'G' * @@ -610,7 +610,7 @@ class calendar_bo } // if we have no grants from the given user(s), we directly return no events / an empty array, // as calling the so-layer without users would give the events of all users (!) - if (!count($users)) + if (!count($users) && !$params['ignore_acl']) { return false; } @@ -665,7 +665,7 @@ class calendar_bo { $is_private = !$this->check_perms(Acl::READ,$event); } - if ($is_private || (!$event['public'] && $filter == 'hideprivate')) + if (!$params['ignore_acl'] && ($is_private || (!$event['public'] && $filter == 'hideprivate'))) { $this->clear_private_infos($events[$id],$users); } @@ -970,11 +970,11 @@ class calendar_bo $time->setTime(23, 59, 59); $event['recur_enddate'] = Api\DateTime::to($time, $date_format); } - $timestamps = array('modified','created'); + $timestamps = array('modified','created','deleted'); } else { - $timestamps = array('start','end','modified','created','recur_enddate','recurrence','recur_date'); + $timestamps = array('start','end','modified','created','recur_enddate','recurrence','recur_date','deleted'); } // we convert here from the server-time timestamps to user-time and (optional) to a different date-format! foreach ($timestamps as $ts) diff --git a/calendar/inc/class.calendar_boupdate.inc.php b/calendar/inc/class.calendar_boupdate.inc.php index 41937d68e6..c4c0e51485 100644 --- a/calendar/inc/class.calendar_boupdate.inc.php +++ b/calendar/inc/class.calendar_boupdate.inc.php @@ -247,7 +247,7 @@ class calendar_boupdate extends calendar_bo //echo "saving $event[id]="; _debug_array($event); $event2save = $event; - if (!($cal_id = $this->save($event, $ignore_acl, $updateTS))) + if (!($cal_id = $this->save($event, $ignore_acl))) { return $cal_id; } @@ -937,7 +937,7 @@ class calendar_boupdate extends calendar_bo // Since we're running from cron, make sure notifications uses user's theme (for images) $GLOBALS['egw_info']['server']['template_set'] = $GLOBALS['egw_info']['user']['preferences']['common']['template_set']; - + $event_arr = null; $details = $this->_get_event_details(isset($cleared_event) ? $cleared_event : $event, $action, $event_arr, $disinvited); @@ -1153,12 +1153,11 @@ class calendar_boupdate extends calendar_bo * @param array $event * @param boolean $ignore_acl =false should we ignore the acl * @param boolean $updateTS =true update the content history of the event - * DEPRECATED: we allways (have to) update timestamp, as they are required for sync! + * Please note: you should ALLWAYS update timestamps, as they are required for sync! * @return int|boolean $cal_id > 0 or false on error (eg. permission denied) */ function save($event,$ignore_acl=false,$updateTS=true) { - unset($updateTS); //error_log(__METHOD__.'('.array2string($event).", $ignore_acl, $updateTS)"); // check if user has the permission to update / create the event @@ -1289,9 +1288,12 @@ class calendar_boupdate extends calendar_bo } } - // always update modification time (ctag depends on it!) - $event['modified'] = $this->now; - $event['modifier'] = $this->user; + // you should always update modification time (ctag depends on it!) + if ($updateTS) + { + $event['modified'] = $this->now; + $event['modifier'] = $this->user; + } if (empty($event['id']) && (!isset($event['created']) || $event['created'] > $this->now)) { diff --git a/calendar/inc/class.calendar_so.inc.php b/calendar/inc/class.calendar_so.inc.php index 42dfcd12c7..b3baff43d1 100644 --- a/calendar/inc/class.calendar_so.inc.php +++ b/calendar/inc/class.calendar_so.inc.php @@ -772,6 +772,7 @@ class calendar_so $where = array_merge($where, $params['sql_filter']); } } + $useUnionQuery = $this->db->capabilities['distinct_on_text'] && $this->db->capabilities['union']; if ($users) { $users_by_type = array(); @@ -790,7 +791,6 @@ class calendar_so } $to_or = $user_or = array(); $owner_or = null; - $useUnionQuery = $this->db->capabilities['distinct_on_text'] && $this->db->capabilities['union']; $table_def = $this->db->get_table_definitions('calendar',$this->user_table); foreach($users_by_type as $type => $ids) { @@ -1057,7 +1057,7 @@ class calendar_so foreach($this->db->select($utcal_id_view,'*',array( //'cal_id' => array_unique($ids), 'cal_recur_date' => $recur_dates, - ),__LINE__,__FILE__,false,'ORDER BY cal_id,cal_user_type DESC,'.self::STATUS_SORT,'calendar',$num_rows,$join='', + ),__LINE__,__FILE__,false,'ORDER BY cal_id,cal_user_type DESC,'.self::STATUS_SORT,'calendar',-1,$join='', $this->db->get_table_definitions('calendar',$this->user_table)) as $row) // DESC puts users before resources and contacts { $id = $row['cal_id']; diff --git a/calendar/setup/tables_current.inc.php b/calendar/setup/tables_current.inc.php index 05f1eb73aa..87101bc8ef 100644 --- a/calendar/setup/tables_current.inc.php +++ b/calendar/setup/tables_current.inc.php @@ -31,7 +31,7 @@ $phpgw_baseline = array( 'cal_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'creation time of event'), 'cal_recurrence' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0','comment' => 'cal_start of original recurrence for exception'), 'tz_id' => array('type' => 'int','precision' => '4','comment' => 'key into egw_cal_timezones'), - 'cal_deleted' => array('type' => 'int','precision' => '8','comment' => 'ts when event was deleted'), + 'cal_deleted' => array('type' => 'int','precision' => '8','meta' => 'timestamp','comment' => 'ts when event was deleted'), 'caldav_name' => array('type' => 'ascii','precision' => '128','comment' => 'name part of CalDAV URL, if specified by client'), 'range_start' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'startdate (of range)'), 'range_end' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'enddate (of range, UNTIL of RRULE)')