* Calendar: notification always use language of current user, not of user to notify

This commit is contained in:
Ralf Becker 2012-05-15 12:43:32 +00:00
parent d2a667c040
commit 6d1dc16ac3

View File

@ -606,55 +606,55 @@ class calendar_boupdate extends calendar_bo
switch($msg_type) switch($msg_type)
{ {
case MSG_DELETED: case MSG_DELETED:
$action = lang('Canceled'); $action = 'Canceled';
$msg = 'Canceled'; $msg = 'Canceled';
$msgtype = '"calendar";'; $msgtype = '"calendar";';
$method = 'CANCEL'; $method = 'CANCEL';
break; break;
case MSG_MODIFIED: case MSG_MODIFIED:
$action = lang('Modified'); $action = 'Modified';
$msg = 'Modified'; $msg = 'Modified';
$msgtype = '"calendar"; Version="'.$version.'"; Id="'.$new_event['id'].'"'; $msgtype = '"calendar"; Version="'.$version.'"; Id="'.$new_event['id'].'"';
$method = 'REQUEST'; $method = 'REQUEST';
break; break;
case MSG_DISINVITE: case MSG_DISINVITE:
$action = lang('Disinvited'); $action = 'Disinvited';
$msg = 'Disinvited'; $msg = 'Disinvited';
$msgtype = '"calendar";'; $msgtype = '"calendar";';
$method = 'CANCEL'; $method = 'CANCEL';
break; break;
case MSG_ADDED: case MSG_ADDED:
$action = lang('Added'); $action = 'Added';
$msg = 'Added'; $msg = 'Added';
$msgtype = '"calendar"; Version="'.$version.'"; Id="'.$new_event['id'].'"'; $msgtype = '"calendar"; Version="'.$version.'"; Id="'.$new_event['id'].'"';
$method = 'REQUEST'; $method = 'REQUEST';
break; break;
case MSG_REJECTED: case MSG_REJECTED:
$action = lang('Rejected'); $action = 'Rejected';
$msg = 'Response'; $msg = 'Response';
$msgtype = '"calendar";'; $msgtype = '"calendar";';
$method = 'REPLY'; $method = 'REPLY';
break; break;
case MSG_TENTATIVE: case MSG_TENTATIVE:
$action = lang('Tentative'); $action = 'Tentative';
$msg = 'Response'; $msg = 'Response';
$msgtype = '"calendar";'; $msgtype = '"calendar";';
$method = 'REPLY'; $method = 'REPLY';
break; break;
case MSG_ACCEPTED: case MSG_ACCEPTED:
$action = lang('Accepted'); $action = 'Accepted';
$msg = 'Response'; $msg = 'Response';
$msgtype = '"calendar";'; $msgtype = '"calendar";';
$method = 'REPLY'; $method = 'REPLY';
break; break;
case MSG_DELEGATED: case MSG_DELEGATED:
$action = lang('Delegated'); $action = 'Delegated';
$msg = 'Response'; $msg = 'Response';
$msgtype = '"calendar";'; $msgtype = '"calendar";';
$method = 'REPLY'; $method = 'REPLY';
break; break;
case MSG_ALARM: case MSG_ALARM:
$action = lang('Alarm'); $action = 'Alarm';
$msg = 'Alarm'; $msg = 'Alarm';
$msgtype = '"calendar";'; $msgtype = '"calendar";';
$method = 'PUBLISH'; // duno if thats right $method = 'PUBLISH'; // duno if thats right
@ -690,6 +690,7 @@ class calendar_boupdate extends calendar_bo
$enddate = new egw_time($event['end']); $enddate = new egw_time($event['end']);
$modified = new egw_time($event['modified']); $modified = new egw_time($event['modified']);
if ($old_event != False) $olddate = new egw_time($old_event['start']); if ($old_event != False) $olddate = new egw_time($old_event['start']);
$lang = $GLOBALS['egw_info']['user']['preferences']['common']['lang'];
foreach($to_notify as $userid => $statusid) foreach($to_notify as $userid => $statusid)
{ {
unset($res_info); unset($res_info);
@ -732,7 +733,7 @@ class calendar_boupdate extends calendar_bo
if (is_numeric($userid)) if (is_numeric($userid))
{ {
$preferences = new preferences($userid); $preferences = new preferences($userid);
$part_prefs = $preferences->read_repository(); $GLOBALS['egw_info']['user']['preferences'] = $part_prefs = $preferences->read_repository();
$GLOBALS['egw']->accounts->get_account_name($userid,$lid,$details['to-firstname'],$details['to-lastname']); $GLOBALS['egw']->accounts->get_account_name($userid,$lid,$details['to-firstname'],$details['to-lastname']);
$details['to-fullname'] = common::display_fullname('',$details['to-firstname'],$details['to-lastname']); $details['to-fullname'] = common::display_fullname('',$details['to-firstname'],$details['to-lastname']);
@ -742,7 +743,7 @@ class calendar_boupdate extends calendar_bo
if (is_null($owner_prefs)) if (is_null($owner_prefs))
{ {
$preferences = new preferences($old_event['owner']); $preferences = new preferences($old_event['owner']);
$owner_prefs = $preferences->read_repository(); $GLOBALS['egw_info']['user']['preferences'] = $owner_prefs = $preferences->read_repository();
} }
$part_prefs = $owner_prefs; $part_prefs = $owner_prefs;
$part_prefs['calendar']['receive_updates'] = $owner_prefs['calendar']['notify_externals']; $part_prefs['calendar']['receive_updates'] = $owner_prefs['calendar']['notify_externals'];
@ -753,6 +754,12 @@ class calendar_boupdate extends calendar_bo
{ {
continue; continue;
} }
if ($lang !== $part_prefs['common']['lang'])
{
translation::init();
$details = $this->_get_event_details($event,$action,$event_arr,$disinvited);
$lang = $part_prefs['common']['lang'];
}
// event is in user-time of current user, now we need to calculate the tz-difference to the notified user and take it into account // event is in user-time of current user, now we need to calculate the tz-difference to the notified user and take it into account
if (!isset($part_prefs['common']['tz'])) $part_prefs['common']['tz'] = $GLOBALS['egw_info']['server']['server_timezone']; if (!isset($part_prefs['common']['tz'])) $part_prefs['common']['tz'] = $GLOBALS['egw_info']['server']['server_timezone'];
$timezone = new DateTimeZone($part_prefs['common']['tz']); $timezone = new DateTimeZone($part_prefs['common']['tz']);
@ -855,6 +862,10 @@ class calendar_boupdate extends calendar_bo
$GLOBALS['egw_info']['user']['preferences'] = $GLOBALS['egw']->preferences->read_repository(); $GLOBALS['egw_info']['user']['preferences'] = $GLOBALS['egw']->preferences->read_repository();
//echo "<p>".__METHOD__."() restored enviroment of #$temp_user[account_id] $temp_user[account_fullname]: tz={$GLOBALS['egw_info']['user']['preferences']['common']['tz']}</p>\n"; //echo "<p>".__METHOD__."() restored enviroment of #$temp_user[account_id] $temp_user[account_fullname]: tz={$GLOBALS['egw_info']['user']['preferences']['common']['tz']}</p>\n";
} }
if ($lang !== $GLOBALS['egw_info']['user']['preferences']['common']['lang'])
{
translation::init();
}
return true; return true;
} }
@ -1386,7 +1397,7 @@ class calendar_boupdate extends calendar_bo
{ {
$details = array( // event-details for the notify-msg $details = array( // event-details for the notify-msg
'id' => $event['id'], 'id' => $event['id'],
'action' => $action, 'action' => lang($action),
); );
$event_arr = $this->event2array($event); $event_arr = $this->event2array($event);
foreach($event_arr as $key => $val) foreach($event_arr as $key => $val)