forked from extern/egroupware
* Calendar: new (forcable) user preference to notify external participants (non-EGroupware users), event owner has to set it, it is off by default, to keep the current behavior of not notifying externals
This commit is contained in:
parent
14c36dd999
commit
7630f59a13
@ -503,9 +503,10 @@ class calendar_boupdate extends calendar_bo
|
||||
* @param int $msg_type type of the notification: MSG_ADDED, MSG_MODIFIED, MSG_ACCEPTED, ...
|
||||
* @param array $old_event Event before the change
|
||||
* @param array $new_event Event after the change
|
||||
* @return boolean true = update requested, flase otherwise
|
||||
* @param string $role we treat CHAIR like event owners
|
||||
* @return boolean true = update requested, false otherwise
|
||||
*/
|
||||
function update_requested($userid,$part_prefs,$msg_type,$old_event,$new_event)
|
||||
function update_requested($userid,$part_prefs,$msg_type,$old_event,$new_event,$role)
|
||||
{
|
||||
if ($msg_type == MSG_ALARM)
|
||||
{
|
||||
@ -528,6 +529,7 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
case 'time_change_4h':
|
||||
case 'time_change':
|
||||
default:
|
||||
$diff = max(abs($this->date2ts($old_event['start'])-$this->date2ts($new_event['start'])),
|
||||
abs($this->date2ts($old_event['end'])-$this->date2ts($new_event['end'])));
|
||||
$check = $ru == 'time_change_4h' ? 4 * 60 * 60 - 1 : 0;
|
||||
@ -536,13 +538,17 @@ class calendar_boupdate extends calendar_bo
|
||||
++$want_update;
|
||||
}
|
||||
case 'add_cancel':
|
||||
if ($old_event['owner'] == $userid && $msg_is_response ||
|
||||
if ($msg_is_response && ($old_event['owner'] == $userid || $role == 'CHAIR') ||
|
||||
$msg_type == MSG_DELETED || $msg_type == MSG_ADDED || $msg_type == MSG_DISINVITE)
|
||||
{
|
||||
++$want_update;
|
||||
}
|
||||
break;
|
||||
case 'no':
|
||||
if ($msg_is_response && $role == 'CHAIR') // always notify chairs!
|
||||
{
|
||||
++$want_update;
|
||||
}
|
||||
break;
|
||||
}
|
||||
//error_log(__METHOD__."(userid=$userid,,msg_type=$msg_type,...) msg_is_response=$msg_is_response, want_update=$want_update");
|
||||
@ -683,19 +689,31 @@ class calendar_boupdate extends calendar_bo
|
||||
if ($old_event != False) $olddate = new egw_time($old_event['start']);
|
||||
foreach($to_notify as $userid => $statusid)
|
||||
{
|
||||
unset($res_info);
|
||||
calendar_so::split_status($statusid, $quantity, $role);
|
||||
if ($this->debug > 0) error_log(__METHOD__." trying to notify $userid, with $statusid ($role)");
|
||||
|
||||
if (!is_numeric($userid) && $userid[0] == 'e')
|
||||
{
|
||||
if ($role != 'CHAIR' || $msg_type == MSG_ALARM) continue; // only notify "external" chairs, but not for alarms
|
||||
$userid = substr($userid,1);
|
||||
}
|
||||
elseif (!is_numeric($userid))
|
||||
if (!is_numeric($userid))
|
||||
{
|
||||
$res_info = $this->resource_info($userid);
|
||||
$userid = $res_info['responsible'];
|
||||
if (!isset($userid)) continue;
|
||||
if (!isset($userid))
|
||||
{
|
||||
if (empty($res_info['email'])) continue; // no way to notify
|
||||
// check if event-owner wants non-EGroupware users notified
|
||||
if (is_null($owner_prefs))
|
||||
{
|
||||
$preferences = new preferences($old_event['owner']);
|
||||
$owner_prefs = $preferences->read_repository();
|
||||
}
|
||||
if ($role != 'CHAIR' && // always notify externals CHAIRs
|
||||
(empty($owner_prefs['calendar']['notify_externals']) ||
|
||||
$owner_prefs['calendar']['notify_externals'] == 'no'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$userid = $res_info['email'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($statusid == 'R' || $GLOBALS['egw']->accounts->get_type($userid) == 'g')
|
||||
@ -710,21 +728,27 @@ class calendar_boupdate extends calendar_bo
|
||||
{
|
||||
if (is_numeric($userid))
|
||||
{
|
||||
$preferences = CreateObject('phpgwapi.preferences',$userid);
|
||||
$preferences = new preferences($userid);
|
||||
$part_prefs = $preferences->read_repository();
|
||||
|
||||
if (!$this->update_requested($userid,$part_prefs,$msg_type,$old_event,$new_event))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$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']);
|
||||
}
|
||||
else // external email address: use current users preferences, plus some hardcoded settings (eg. ical notification)
|
||||
else // external email address: use preferences of event-owner, plus some hardcoded settings (eg. ical notification)
|
||||
{
|
||||
$details['to-fullname'] = $userid;
|
||||
$part_prefs = $GLOBALS['egw_info']['user']['preferences'];
|
||||
if (is_null($owner_prefs))
|
||||
{
|
||||
$preferences = new preferences($old_event['owner']);
|
||||
$owner_prefs = $preferences->read_repository();
|
||||
}
|
||||
$part_prefs = $owner_prefs;
|
||||
$part_prefs['calendar']['receive_updates'] = $owner_prefs['calendar']['notify_externals'];
|
||||
$part_prefs['calendar']['update_format'] = 'ical'; // use ical format
|
||||
$details['to-fullname'] = $res_info && !empty($res_info['name']) ? $res_info['name'] : $userid;
|
||||
}
|
||||
if (!$this->update_requested($userid,$part_prefs,$msg_type,$old_event,$new_event,$role))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// 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'];
|
||||
|
@ -452,6 +452,16 @@ class calendar_hooks
|
||||
'admin' => False,
|
||||
'forced' => 'ical',
|
||||
),
|
||||
'notify_externals' => array(
|
||||
'type' => 'select',
|
||||
'label' => 'Notify non-EGroupware users about event updates',
|
||||
'name' => 'notify_externals',
|
||||
'values' => $updates,
|
||||
'help' => 'Do you want non-EGroupware participants of events you created to be automatically notified about new or changed appointments?',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False,
|
||||
'default'=> 'no',
|
||||
),
|
||||
'export_timezone' => array(
|
||||
'type' => 'select',
|
||||
'label' => 'Timezone of event iCal file import/export',
|
||||
|
@ -140,6 +140,7 @@ displays this calendar view on the home page (page you get when you enter egroup
|
||||
do not include events of group members calendar de Zeige nicht die Termine der Gruppenmitglieder
|
||||
do you really want to change the start of this series? if you do, the original series will be terminated as of today and a new series for the future reflecting your changes will be created. calendar de Wollen Sie wirklich den Beginn dieses Serientermins ändern? Wenn Sie das tun, so wird die bestehende Serie heute beendet und für die Zukunft ein neuer Wiederholungstermin mit Ihren Änderungen erzeugt.
|
||||
do you want a weekview with or without weekend? calendar de Möchten Sie eine Wochenansicht mit oder ohne Wochenende?
|
||||
do you want non-egroupware participants of events you created to be automatically notified about new or changed appointments? calendar de Sollen Teilnehmer, die keine EGroupware Benutzer sind, automatisch über Änderungen an von Ihnen angelegten Terminen benachrichtigt werden?
|
||||
do you want to be notified about changes of appointments you modified? calendar de Wollen Sie auch über eigene Änderungen Benachrichtigt werden?
|
||||
do you want to be notified about new or changed appointments? you are not notified about changes you made yourself.<br>you can limit the notifications to certain changes only. each item includes all notifications listed above. all modifications include changes of title, description, participants, but no participant responses. if the owner of an event requested any notifcations, he will always get participant responses like acceptions or rejections too. calendar de Möchten Sie über neue oder geänderte Termine informiert werden? Sie werden NICHT über Änderungen informiert, die Sie selbst anwenden.<br />Sie können die Benachrichtigungen auf bestimmte Änderungen beschränken. Jede Auswahl beinhaltet die oben aufgeführten Benachrichtigungen. Alle Änderungen beinhalten Änderungen des Titels, der Beschreibung, der Teilnehmer, aber keine Antworten der Teilnehmer. Falls der Besitzer eines Termins eine Benachrichtigung angefordert hat, werden auch die Teilnehmer-Antworten (Annahmen oder Absagen) zur Verfügung gestellt.
|
||||
do you want to be notified about new or changed appointments? you be notified about changes you make yourself.<br>you can limit the notifications to certain changes only. each item includes all the notification listed above it. all modifications include changes of title, description, participants, but no participant responses. if the owner of an event requested any notifcations, he will always get the participant responses like acceptions and rejections too. calendar de Möchten Sie über neue oder geänderte Termine informiert werden? Sie werden NICHT über Änderungen informiert, die Sie selbst anwenden.<br />Sie können die Benachrichtigungen auf bestimmte Änderungen beschränken. Jede Auswahl beinhaltet die oben aufgeführten Benachrichtigungen. Alle Änderungen beinhalten Änderungen des Titels, der Beschreibung, der Teilnehmer, aber keine Antworten der Teilnehmer. Falls der Besitzer eines Termins eine Benachrichtigung angefordert hat, werden auch die Teilnehmer-Antworten (Annahmen oder Absagen) zur Verfügung gestellt.
|
||||
@ -312,6 +313,7 @@ notification messages for disinvited participants calendar de Benachrichtigungst
|
||||
notification messages for modified events calendar de Benachrichtigungstext für geänderte Termine
|
||||
notification messages for your alarms calendar de Benachrichtigungstext für Ihre Alarme
|
||||
notification messages for your responses calendar de Benachrichtigungstext für Ihre Antworten
|
||||
notify non-egroupware users about event updates calendar de Teilnehmer außerhalb EGroupware über Terminänderungen benachrichtigen?
|
||||
number of records to read (%1) calendar de Anzahl der zu lesenden Datensätze (%1)
|
||||
number of weeks to show calendar de Anzahl Wochen anzuzeigen
|
||||
observance rule calendar de Observance Rule
|
||||
|
@ -140,6 +140,7 @@ displays this calendar view on the home page (page you get when you enter egroup
|
||||
do not include events of group members calendar en Do not include events of group members
|
||||
do you really want to change the start of this series? if you do, the original series will be terminated as of today and a new series for the future reflecting your changes will be created. calendar en Do you really want to change the start of this series? If you do, the original series will be terminated as of today and a new series for the future reflecting your changes will be created.
|
||||
do you want a weekview with or without weekend? calendar en Do you want a weekview with or without weekend?
|
||||
do you want non-egroupware participants of events you created to be automatically notified about new or changed appointments? calendar en Do you want non-EGroupware participants of events you created to be automatically notified about new or changed appointments?
|
||||
do you want to be notified about changes of appointments you modified? calendar en Do you want to be notified about changes of appointments you modified?
|
||||
do you want to be notified about new or changed appointments? you are not notified about changes you made yourself.<br>you can limit the notifications to certain changes only. each item includes all notifications listed above. all modifications include changes of title, description, participants, but no participant responses. if the owner of an event requested any notifcations, he will always get participant responses like acceptions or rejections too. calendar en Do you want to be notified about new or changed appointments? You are NOT notified about changes you made yourself.<br>You can limit the notifications to certain changes only. Each item includes all notifications listed above. All modifications include changes of title, description, participants, but no participant responses. If the owner of an event requested any notifications, he will always get participant responses like acceptations or rejections too.
|
||||
do you want to be notified about new or changed appointments? you be notified about changes you make yourself.<br>you can limit the notifications to certain changes only. each item includes all the notification listed above it. all modifications include changes of title, description, participants, but no participant responses. if the owner of an event requested any notifcations, he will always get the participant responses like acceptions and rejections too. calendar en Do you want to be notified about new or changed appointments? You be notified about changes you make yourself.<br>You can limit the notifications to certain changes only. Each item includes all the notification listed above it. All modifications include changes of title, description, participants, but no participant responses. If the owner of an event requested any notifications, he will always get the participant responses like acceptations and rejections too.
|
||||
@ -312,6 +313,7 @@ notification messages for disinvited participants calendar en Notification messa
|
||||
notification messages for modified events calendar en Notification messages for modified events
|
||||
notification messages for your alarms calendar en Notification messages for your alarms
|
||||
notification messages for your responses calendar en Notification messages for your responses
|
||||
notify non-egroupware users about event updates calendar en Notify non-EGroupware users about event updates
|
||||
number of records to read (%1) calendar en Number of records to read (%1)
|
||||
number of weeks to show calendar en Number of weeks to show
|
||||
observance rule calendar en Observance rule
|
||||
|
Loading…
Reference in New Issue
Block a user