* Calendar/CalDAV: recurring events with non-EGroupware participants (specified by email) were showing additional participants with cryptic mailto addresses (DB update required!)

because egw_cal_user.cal_user_attendee in recurrences was lost due a typo, includes update script to fix existing entries
This commit is contained in:
Ralf Becker 2015-11-03 13:41:16 +00:00
parent bb466cd20d
commit 8c9f704444
3 changed files with 45 additions and 5 deletions

View File

@ -2149,7 +2149,7 @@ ORDER BY cal_user_type, cal_usre_id
'cal_status' => $status,
'cal_quantity' => $quantity,
'cal_role' => $role,
'cal_attendee' => $type == 'e' ? substr($uid, 1) : null,
'cal_user_attendee' => $type == 'e' ? substr($uid, 1) : null,
),array(
'cal_id' => $cal_id,
'cal_recur_date' => $start,

View File

@ -10,7 +10,7 @@
*/
$setup_info['calendar']['name'] = 'calendar';
$setup_info['calendar']['version'] = '14.3.900';
$setup_info['calendar']['version'] = '14.3.901';
$setup_info['calendar']['app_order'] = 3;
$setup_info['calendar']['enable'] = 1;
$setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index&ajax=true';

View File

@ -2573,7 +2573,7 @@ function calendar_upgrade14_3()
// by ordering by status we prever accepted over tentative over unknow over deleted
foreach($GLOBALS['egw_setup']->db->select('egw_cal_user', "cal_id,cal_recur_date,$email AS email", array(
'cal_user_type' => 'e',
), __LINE__, __FILE__, false, "GROUP BY cal_id,cal_recur_date,$email HAVING COUNT(*)>1") as $row)
), __LINE__, __FILE__, false, "GROUP BY cal_id,cal_recur_date,$email HAVING COUNT(*)>1", 'calendar') as $row)
{
$n = 0;
foreach($GLOBALS['egw_setup']->db->select('egw_cal_user', "*,$email AS email", array(
@ -2581,7 +2581,7 @@ function calendar_upgrade14_3()
'cal_recur_date' => $row['cal_recur_date'],
'cal_user_type' => 'e',
$email.'='.$GLOBALS['egw_setup']->db->quote($row['email']),
), __LINE__, __FILE__, 'ORDER BY cal_status') as $user) // order A, T, U, X
), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user) // order A, T, U, X
{
if (strpos($user['email'], '@') !== false && !$n++) continue;
$GLOBALS['egw_setup']->db->delete('egw_cal_user', array_intersect_key($user, array_flip(array('cal_id','cal_recur_date','cal_user_type','cal_user_id','cal_status'))));
@ -2606,13 +2606,53 @@ function calendar_upgrade14_3()
return $GLOBALS['setup_info']['calendar']['currentver'] = '14.3.001';
}
/**
* Fix NULL in egw_cal_user.cal_user_attendee for recurrences by using value from master (cal_recur_date=0)
*
* @return string
*/
function calendar_upgrade14_3_001()
{
$GLOBALS['calendar_upgrade14_3_001-run'] = true;
foreach($GLOBALS['egw_setup']->db->query("SELECT egw_cal_user.cal_id AS cal_id,egw_cal_user.cal_user_id AS cal_user_id,egw_cal_user.cal_user_attendee AS cal_user_attendee
FROM egw_cal_user
JOIN egw_cal_user user ON user.cal_id=egw_cal_user.cal_id AND user.cal_user_type='e' AND user.cal_user_id=egw_cal_user.cal_user_id AND user.cal_user_attendee IS NULL
WHERE egw_cal_user.cal_user_type='e' AND egw_cal_user.cal_user_attendee IS NOT NULL
GROUP BY egw_cal_user.cal_id,egw_cal_user.cal_user_id,egw_cal_user.cal_user_attendee", __LINE__, __FILE__) as $row)
{
$GLOBALS['egw_setup']->db->update('egw_cal_user', array(
'cal_user_attendee' => $row['cal_user_attendee'],
), array(
'cal_id' => $row['cal_id'],
'cal_user_type' => 'e',
'cal_user_id' => $row['cal_user_id'],
'cal_user_attendee IS NULL'
), __LINE__, __FILE__, 'calendar');
}
return $GLOBALS['setup_info']['calendar']['currentver'] = '14.3.002';
}
/**
* Setting new index url from setup.inc.php
*
* @return string
*/
function calendar_upgrade14_3_001()
function calendar_upgrade14_3_002()
{
return $GLOBALS['setup_info']['calendar']['currentver'] = '14.3.900';
}
/**
* Setting new index url from setup.inc.php
*
* @return string
*/
function calendar_upgrade14_3_900()
{
if (empty($GLOBALS['calendar_upgrade14_3_001-run']))
{
calendar_upgrade14_3_001();
}
return $GLOBALS['setup_info']['calendar']['currentver'] = '14.3.901';
}