mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
Change preserving deleted events. For speed improvements, use an extra column instead of joining to the sync tables
This commit is contained in:
parent
27e54cb692
commit
074b893e37
@ -1165,9 +1165,15 @@ class calendar_boupdate extends calendar_bo
|
||||
if (!$recur_date || $event['recur_type'] == MCAL_RECUR_NONE)
|
||||
{
|
||||
$config = config::read('phpgwapi');
|
||||
if(!$config['calendar_delete_history'] || $GLOBALS['egw']->contenthistory->getTSforAction('calendar', $cal_id, 'delete')) {
|
||||
if(!$config['calendar_delete_history'] || $event['deleted'])
|
||||
{
|
||||
$this->so->delete($cal_id);
|
||||
}
|
||||
elseif ($config['calendar_delete_history'])
|
||||
{
|
||||
$event['deleted'] = true;
|
||||
$this->save($event);
|
||||
}
|
||||
$GLOBALS['egw']->contenthistory->updateTimeStamp('calendar',$cal_id,'delete',time());
|
||||
|
||||
// delete all links to the event
|
||||
|
@ -399,12 +399,12 @@ class calendar_so
|
||||
if (!$useUnionQuery) $where[] = '('.implode(' OR ',$to_or).')';
|
||||
|
||||
if($filter != 'deleted') {
|
||||
$where[] = "sync_deleted IS NULL";
|
||||
$where[] = "!cal_deleted";
|
||||
}
|
||||
switch($filter)
|
||||
{
|
||||
case 'deleted':
|
||||
$where[] = "sync_deleted IS NOT NULL"; break;
|
||||
$where[] = "cal_deleted"; break;
|
||||
case 'unknown':
|
||||
$where[] = "cal_status='U'"; break;
|
||||
case 'accepted':
|
||||
@ -448,7 +448,7 @@ class calendar_so
|
||||
// changed the original OR in the query into a union, to speed up the query execution under MySQL 5
|
||||
$select = array(
|
||||
'table' => $this->cal_table,
|
||||
'join' => "JOIN $this->dates_table ON $this->cal_table.cal_id=$this->dates_table.cal_id JOIN $this->user_table ON $this->cal_table.cal_id=$this->user_table.cal_id LEFT JOIN $this->repeats_table ON $this->cal_table.cal_id=$this->repeats_table.cal_id JOIN egw_api_content_history ON egw_api_content_history.sync_appname = 'calendar' AND egw_api_content_history.sync_contentid = $history_id",
|
||||
'join' => "JOIN $this->dates_table ON $this->cal_table.cal_id=$this->dates_table.cal_id JOIN $this->user_table ON $this->cal_table.cal_id=$this->user_table.cal_id LEFT JOIN $this->repeats_table ON $this->cal_table.cal_id=$this->repeats_table.cal_id",
|
||||
'cols' => $cols,
|
||||
'where' => $where,
|
||||
'app' => 'calendar',
|
||||
|
@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
$setup_info['calendar']['name'] = 'calendar';
|
||||
$setup_info['calendar']['version'] = '1.7.010';
|
||||
$setup_info['calendar']['version'] = '1.7.011';
|
||||
$setup_info['calendar']['app_order'] = 3;
|
||||
$setup_info['calendar']['enable'] = 1;
|
||||
$setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index';
|
||||
@ -66,3 +66,4 @@ $setup_info['calendar']['check_install'] = array(
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
@ -30,7 +30,8 @@ $phpgw_baseline = array(
|
||||
'cal_creator' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'creating user'),
|
||||
'cal_created' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'creation time of event'),
|
||||
'cal_recurrence' => array('type' => 'int','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')
|
||||
'tz_id' => array('type' => 'int','precision' => '4','comment' => 'key into egw_cal_timezones'),
|
||||
'cal_deleted' => array('type' => 'bool','nullable' => False,'default' => '0','comment' => '1 if the event has been deleted, but you want to keep it around')
|
||||
),
|
||||
'pk' => array('cal_id'),
|
||||
'fk' => array(),
|
||||
|
@ -2077,3 +2077,16 @@ function calendar_upgrade1_7_009()
|
||||
|
||||
return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.010';
|
||||
}
|
||||
|
||||
function calendar_upgrade1_7_010()
|
||||
{
|
||||
$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_deleted',array(
|
||||
'type' => 'bool',
|
||||
'nullable' => False,
|
||||
'default' => '0',
|
||||
'comment' => '1 if the event has been deleted, but you want to keep it around'
|
||||
));
|
||||
|
||||
return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.011';
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user