database updates: fix whole day event cal_end times and fix wrong recur_interval values. The first fix reduces duplicates on SyncML slowsyncs. The second fix prevents event series from being destroyed when a new exception was created on series created on previous EGw versions. Please update your databases.

This commit is contained in:
Christian Binder 2010-01-14 17:12:11 +00:00
parent 14e7c0cd87
commit 2e71e7e80f
2 changed files with 30 additions and 2 deletions

View File

@ -10,7 +10,7 @@
*/ */
$setup_info['calendar']['name'] = 'calendar'; $setup_info['calendar']['name'] = 'calendar';
$setup_info['calendar']['version'] = '1.7.006'; $setup_info['calendar']['version'] = '1.7.007';
$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';

View File

@ -1941,4 +1941,32 @@ function calendar_upgrade1_7_005()
} }
} }
return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.006'; return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.006';
} }
/**
* // Fix whole day event cal_end times which are set to 23:59:00 or 00:00 instead of 23:59:59
* // Fix recur_interval from 0 to 1 for event series
*
* @return string
*/
function calendar_upgrade1_7_006()
{
foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates
WHERE (cal_end-cal_start)%86400=86340',__LINE__,__FILE__) as $row)
{
$GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end+59
WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__);
}
foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates
WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__,__FILE__) as $row)
{
$GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end-1
WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__);
}
$GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1
WHERE recur_interval=0',__LINE__,__FILE__);
return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007';
}