mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-27 13:22:06 +02:00
storing deleted timestamp instead of a deleted flag, to allow to use calendar table instead of egw_api_content_history later on
This commit is contained in:
parent
8160ff2472
commit
8241be4091
@ -819,9 +819,6 @@ class calendar_bo
|
|||||||
$alarm['time'] = $this->date2usertime($alarm['time'],$date_format);
|
$alarm['time'] = $this->date2usertime($alarm['time'],$date_format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix deleted flag
|
|
||||||
$event['deleted'] = egw_db::from_bool($event['deleted']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1227,7 +1227,7 @@ class calendar_boupdate extends calendar_bo
|
|||||||
}
|
}
|
||||||
elseif ($config['calendar_delete_history'])
|
elseif ($config['calendar_delete_history'])
|
||||||
{
|
{
|
||||||
$event['deleted'] = true;
|
$event['deleted'] = time();
|
||||||
$this->save($event, $ignore_acl);
|
$this->save($event, $ignore_acl);
|
||||||
// Actually delete alarms
|
// Actually delete alarms
|
||||||
if (isset($event['alarm']) && is_array($event['alarm']))
|
if (isset($event['alarm']) && is_array($event['alarm']))
|
||||||
|
@ -403,7 +403,7 @@ class calendar_so
|
|||||||
|
|
||||||
if($filter != 'deleted')
|
if($filter != 'deleted')
|
||||||
{
|
{
|
||||||
$where['cal_deleted'] = false;
|
$where[] = 'cal_deleted IS NULL';
|
||||||
}
|
}
|
||||||
switch($filter)
|
switch($filter)
|
||||||
{
|
{
|
||||||
@ -411,7 +411,7 @@ class calendar_so
|
|||||||
$where['cal_public'] = 1;
|
$where['cal_public'] = 1;
|
||||||
$where[] = "cal_status != 'R'"; break;
|
$where[] = "cal_status != 'R'"; break;
|
||||||
case 'deleted':
|
case 'deleted':
|
||||||
$where['cal_deleted'] = true; break;
|
$where[] = 'cal_deleted IS NOT NULL'; break;
|
||||||
case 'unknown':
|
case 'unknown':
|
||||||
$where[] = "cal_status='U'"; break;
|
$where[] = "cal_status='U'"; break;
|
||||||
case 'accepted':
|
case 'accepted':
|
||||||
|
@ -1442,8 +1442,8 @@ function replace_eTemplate_onsubmit()
|
|||||||
$config = config::read('phpgwapi');
|
$config = config::read('phpgwapi');
|
||||||
if($config['calendar_delete_history'] && $event['deleted'] && $GLOBALS['egw_info']['user']['apps']['admin'])
|
if($config['calendar_delete_history'] && $event['deleted'] && $GLOBALS['egw_info']['user']['apps']['admin'])
|
||||||
{
|
{
|
||||||
$content['deleted'] = $preserv['deleted'] = false;
|
$content['deleted'] = $preserv['deleted'] = null;
|
||||||
$etpl->set_cell_attribute('button[save]', 'label', 'recover');
|
$etpl->set_cell_attribute('button[save]', 'label', 'Recover');
|
||||||
$etpl->set_cell_attribute('button[apply]', 'disabled', true);
|
$etpl->set_cell_attribute('button[apply]', 'disabled', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$setup_info['calendar']['name'] = 'calendar';
|
$setup_info['calendar']['name'] = 'calendar';
|
||||||
$setup_info['calendar']['version'] = '1.9.001';
|
$setup_info['calendar']['version'] = '1.9.002';
|
||||||
$setup_info['calendar']['app_order'] = 3;
|
$setup_info['calendar']['app_order'] = 3;
|
||||||
$setup_info['calendar']['enable'] = 1;
|
$setup_info['calendar']['enable'] = 1;
|
||||||
$setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index';
|
$setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index';
|
||||||
@ -68,3 +68,4 @@ $setup_info['calendar']['check_install'] = array(
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,11 +31,11 @@ $phpgw_baseline = array(
|
|||||||
'cal_created' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'creation time of event'),
|
'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'),
|
'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')
|
'cal_deleted' => array('type' => 'int','precision' => '8','comment' => 'ts when event was deleted')
|
||||||
),
|
),
|
||||||
'pk' => array('cal_id'),
|
'pk' => array('cal_id'),
|
||||||
'fk' => array(),
|
'fk' => array(),
|
||||||
'ix' => array('cal_uid','cal_owner'),
|
'ix' => array('cal_uid','cal_owner','cal_deleted'),
|
||||||
'uc' => array()
|
'uc' => array()
|
||||||
),
|
),
|
||||||
'egw_cal_holidays' => array(
|
'egw_cal_holidays' => array(
|
||||||
|
@ -2102,3 +2102,53 @@ function calendar_upgrade1_8()
|
|||||||
return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.001';
|
return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.001';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert bool column cal_deleted with egw_api_content_history table to a unix timestamp
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function calendar_upgrade1_9_001()
|
||||||
|
{
|
||||||
|
/* done by RefreshTable() anyway
|
||||||
|
$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_deleted',array(
|
||||||
|
'type' => 'int',
|
||||||
|
'precision' => '8',
|
||||||
|
'comment' => 'ts when event was deleted'
|
||||||
|
));*/
|
||||||
|
$GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal',array(
|
||||||
|
'fd' => array(
|
||||||
|
'cal_id' => array('type' => 'auto','nullable' => False),
|
||||||
|
'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False,'comment' => 'unique id of event(-series)'),
|
||||||
|
'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'event owner / calendar'),
|
||||||
|
'cal_category' => array('type' => 'varchar','precision' => '30','comment' => 'category id'),
|
||||||
|
'cal_modified' => array('type' => 'int','precision' => '8','comment' => 'ts of last modification'),
|
||||||
|
'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'),
|
||||||
|
'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1','comment' => '1=public, 0=private event'),
|
||||||
|
'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'),
|
||||||
|
'cal_description' => array('type' => 'text'),
|
||||||
|
'cal_location' => array('type' => 'varchar','precision' => '255'),
|
||||||
|
'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'cal_id of series for exception'),
|
||||||
|
'cal_modifier' => array('type' => 'int','precision' => '4','comment' => 'user who last modified event'),
|
||||||
|
'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0','comment' => '1 for non-blocking events'),
|
||||||
|
'cal_special' => array('type' => 'int','precision' => '2','default' => '0'),
|
||||||
|
'cal_etag' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'etag for optimistic locking'),
|
||||||
|
'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'),
|
||||||
|
'cal_deleted' => array('type' => 'int','precision' => '8','comment' => 'ts when event was deleted')
|
||||||
|
),
|
||||||
|
'pk' => array('cal_id'),
|
||||||
|
'fk' => array(),
|
||||||
|
'ix' => array('cal_uid','cal_owner','cal_deleted'),
|
||||||
|
'uc' => array()
|
||||||
|
),array(
|
||||||
|
'cal_deleted' => 'CASE cal_deleted WHEN '.$GLOBALS['egw_setup']->db->quote(true,'bool').' THEN '.
|
||||||
|
'(SELECT '.$GLOBALS['egw_setup']->db->unix_timestamp('sync_deleted').
|
||||||
|
" FROM egw_api_content_history WHERE sync_appname='calendar' AND sync_contentid=cal_id)".
|
||||||
|
' ELSE NULL END',
|
||||||
|
));
|
||||||
|
|
||||||
|
return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.002';
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user