mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 08:34:42 +01:00
modifications to allow exporting of all calendar entries via stylite/migrate.php script, added cal_deleted as timestamp and support again setting $updateTS=false in calendar_boupdate::save()
This commit is contained in:
parent
a37a6ccbb8
commit
afaa722c47
@ -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)
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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'];
|
||||
|
@ -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)')
|
||||
|
Loading…
Reference in New Issue
Block a user