* 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)
{
case MSG_DELETED:
$action = lang('Canceled');
$action = 'Canceled';
$msg = 'Canceled';
$msgtype = '"calendar";';
$method = 'CANCEL';
break;
case MSG_MODIFIED:
$action = lang('Modified');
$action = 'Modified';
$msg = 'Modified';
$msgtype = '"calendar"; Version="'.$version.'"; Id="'.$new_event['id'].'"';
$method = 'REQUEST';
break;
case MSG_DISINVITE:
$action = lang('Disinvited');
$action = 'Disinvited';
$msg = 'Disinvited';
$msgtype = '"calendar";';
$method = 'CANCEL';
break;
case MSG_ADDED:
$action = lang('Added');
$action = 'Added';
$msg = 'Added';
$msgtype = '"calendar"; Version="'.$version.'"; Id="'.$new_event['id'].'"';
$method = 'REQUEST';
break;
case MSG_REJECTED:
$action = lang('Rejected');
$action = 'Rejected';
$msg = 'Response';
$msgtype = '"calendar";';
$method = 'REPLY';
break;
case MSG_TENTATIVE:
$action = lang('Tentative');
$action = 'Tentative';
$msg = 'Response';
$msgtype = '"calendar";';
$method = 'REPLY';
break;
case MSG_ACCEPTED:
$action = lang('Accepted');
$action = 'Accepted';
$msg = 'Response';
$msgtype = '"calendar";';
$method = 'REPLY';
break;
case MSG_DELEGATED:
$action = lang('Delegated');
$action = 'Delegated';
$msg = 'Response';
$msgtype = '"calendar";';
$method = 'REPLY';
break;
case MSG_ALARM:
$action = lang('Alarm');
$action = 'Alarm';
$msg = 'Alarm';
$msgtype = '"calendar";';
$method = 'PUBLISH'; // duno if thats right
@ -690,6 +690,7 @@ class calendar_boupdate extends calendar_bo
$enddate = new egw_time($event['end']);
$modified = new egw_time($event['modified']);
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)
{
unset($res_info);
@ -732,7 +733,7 @@ class calendar_boupdate extends calendar_bo
if (is_numeric($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']);
$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))
{
$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['calendar']['receive_updates'] = $owner_prefs['calendar']['notify_externals'];
@ -753,6 +754,12 @@ class calendar_boupdate extends calendar_bo
{
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
if (!isset($part_prefs['common']['tz'])) $part_prefs['common']['tz'] = $GLOBALS['egw_info']['server']['server_timezone'];
$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();
//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;
}
@ -1386,7 +1397,7 @@ class calendar_boupdate extends calendar_bo
{
$details = array( // event-details for the notify-msg
'id' => $event['id'],
'action' => $action,
'action' => lang($action),
);
$event_arr = $this->event2array($event);
foreach($event_arr as $key => $val)