1# -- 2# Copyright (C) 2001-2020 OTRS AG, https://otrs.com/ 3# -- 4# This software comes with ABSOLUTELY NO WARRANTY. For details, see 5# the enclosed file COPYING for license information (GPL). If you 6# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt. 7# -- 8 9package scripts::DBUpdateTo6::AddAppointmentCalendarNotification; ## no critic 10 11use strict; 12use warnings; 13 14use parent qw(scripts::DBUpdateTo6::Base); 15 16our @ObjectDependencies = ( 17 'Kernel::System::NotificationEvent', 18 'Kernel::System::Valid', 19); 20 21=head1 NAME 22 23scripts::DBUpdateTo6::AddAppointmentCalendarNotification - Add AppointmentCalendar notification. 24 25=cut 26 27sub Run { 28 my ( $Self, %Param ) = @_; 29 30 my %AppointmentNotifications = ( 31 'Appointment reminder notification' => { 32 Data => { 33 NotificationType => ['Appointment'], 34 VisibleForAgent => [1], 35 VisibleForAgentTooltip => [ 36 'You will receive a notification each time a reminder time is reached for one of your appointments.' 37 ], 38 Events => ['AppointmentNotification'], 39 Recipients => ['AppointmentAgentReadPermissions'], 40 SendOnOutOfOffice => [1], 41 Transports => ['Email'], 42 AgentEnabledByDefault => ['Email'], 43 }, 44 Message => { 45 'de' => { 46 'Body' => 'Hallo <OTRS_NOTIFICATION_RECIPIENT_UserFirstname>,<br /> 47<br /> 48Termin "<OTRS_APPOINTMENT_TITLE>" hat seine Benachrichtigungszeit erreicht.<br /> 49<br /> 50Beschreibung: <OTRS_APPOINTMENT_DESCRIPTION><br /> 51Standort: <OTRS_APPOINTMENT_LOCATION><br /> 52Kalender: <span style="color: <OTRS_CALENDAR_COLOR>;">■</span> <OTRS_CALENDAR_CALENDARNAME><br /> 53Startzeitpunkt: <OTRS_APPOINTMENT_STARTTIME><br /> 54Endzeitpunkt: <OTRS_APPOINTMENT_ENDTIME><br /> 55Ganztägig: <OTRS_APPOINTMENT_ALLDAY><br /> 56Wiederholung: <OTRS_APPOINTMENT_RECURRING><br /> 57<br /> 58<a href="<OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentAppointmentCalendarOverview;AppointmentID=<OTRS_APPOINTMENT_APPOINTMENTID>" title="<OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentAppointmentCalendarOverview;AppointmentID=<OTRS_APPOINTMENT_APPOINTMENTID>"><OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentAppointmentCalendarOverview;AppointmentID=<OTRS_APPOINTMENT_APPOINTMENTID></a><br /> 59<br /> 60-- <OTRS_CONFIG_NotificationSenderName>', 61 'ContentType' => 'text/html', 62 'Subject' => 'Erinnerung: <OTRS_APPOINTMENT_TITLE>', 63 }, 64 'en' => { 65 'Body' => 'Hi <OTRS_NOTIFICATION_RECIPIENT_UserFirstname>,<br /> 66<br /> 67appointment "<OTRS_APPOINTMENT_TITLE>" has reached its notification time.<br /> 68<br /> 69Description: <OTRS_APPOINTMENT_DESCRIPTION><br /> 70Location: <OTRS_APPOINTMENT_LOCATION><br /> 71Calendar: <span style="color: <OTRS_CALENDAR_COLOR>;">■</span> <OTRS_CALENDAR_CALENDARNAME><br /> 72Start date: <OTRS_APPOINTMENT_STARTTIME><br /> 73End date: <OTRS_APPOINTMENT_ENDTIME><br /> 74All-day: <OTRS_APPOINTMENT_ALLDAY><br /> 75Repeat: <OTRS_APPOINTMENT_RECURRING><br /> 76<br /> 77<a href="<OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentAppointmentCalendarOverview;AppointmentID=<OTRS_APPOINTMENT_APPOINTMENTID>" title="<OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentAppointmentCalendarOverview;AppointmentID=<OTRS_APPOINTMENT_APPOINTMENTID>"><OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentAppointmentCalendarOverview;AppointmentID=<OTRS_APPOINTMENT_APPOINTMENTID></a><br /> 78<br /> 79-- <OTRS_CONFIG_NotificationSenderName>', 80 'ContentType' => 'text/html', 81 'Subject' => 'Reminder: <OTRS_APPOINTMENT_TITLE>', 82 }, 83 'hu' => { 84 'Body' => 'Kedves <OTRS_NOTIFICATION_RECIPIENT_UserFirstname>!<br /> 85<br /> 86A következő esemény elérte az értesítési idejét: <OTRS_APPOINTMENT_TITLE><br /> 87<br /> 88Leírás: <OTRS_APPOINTMENT_DESCRIPTION><br /> 89Hely: <OTRS_APPOINTMENT_LOCATION><br /> 90Naptár: <span style="color: <OTRS_CALENDAR_COLOR>;">■</span> <OTRS_CALENDAR_CALENDARNAME><br /> 91Kezdési dátum: <OTRS_APPOINTMENT_STARTTIME><br /> 92Befejezési dátum: <OTRS_APPOINTMENT_ENDTIME><br /> 93Egész napos: <OTRS_APPOINTMENT_ALLDAY><br /> 94Ismétlődés: <OTRS_APPOINTMENT_RECURRING><br /> 95<br /> 96<a href="<OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentAppointmentCalendarOverview;AppointmentID=<OTRS_APPOINTMENT_APPOINTMENTID>" title="<OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentAppointmentCalendarOverview;AppointmentID=<OTRS_APPOINTMENT_APPOINTMENTID>"><OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentAppointmentCalendarOverview;AppointmentID=<OTRS_APPOINTMENT_APPOINTMENTID></a><br /> 97<br /> 98-- <OTRS_CONFIG_NotificationSenderName>', 99 'ContentType' => 'text/html', 100 'Subject' => 'Emlékeztető: <OTRS_APPOINTMENT_TITLE>', 101 }, 102 'sr_Cyrl' => { 103 'Body' => 'Здраво <OTRS_NOTIFICATION_RECIPIENT_UserFirstname>,<br /> 104<br /> 105време је за обавештење у вези термина "<OTRS_APPOINTMENT_TITLE>".<br /> 106<br /> 107Опис: <OTRS_APPOINTMENT_DESCRIPTION><br /> 108Локација: <OTRS_APPOINTMENT_LOCATION><br /> 109Календар: <span style="color: <OTRS_CALENDAR_COLOR>;">■</span> <OTRS_CALENDAR_CALENDARNAME><br /> 110Датум почетка: <OTRS_APPOINTMENT_STARTTIME><br /> 111Датум краја: <OTRS_APPOINTMENT_ENDTIME><br /> 112Целодневно: <OTRS_APPOINTMENT_ALLDAY><br /> 113Понављање: <OTRS_APPOINTMENT_RECURRING><br /> 114<br /> 115<a href="<OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentAppointmentCalendarOverview;AppointmentID=<OTRS_APPOINTMENT_APPOINTMENTID>" title="<OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentAppointmentCalendarOverview;AppointmentID=<OTRS_APPOINTMENT_APPOINTMENTID>"><OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentAppointmentCalendarOverview;AppointmentID=<OTRS_APPOINTMENT_APPOINTMENTID></a><br /> 116<br /> 117-- <OTRS_CONFIG_NotificationSenderName>', 118 'ContentType' => 'text/html', 119 'Subject' => 'Подсетник: <OTRS_APPOINTMENT_TITLE>', 120 }, 121 'sr_Latn' => { 122 'Body' => 'Zdravo <OTRS_NOTIFICATION_RECIPIENT_UserFirstname>,<br /> 123<br /> 124vreme je za obaveštenje u vezi termina "<OTRS_APPOINTMENT_TITLE>".<br /> 125<br /> 126Opis: <OTRS_APPOINTMENT_DESCRIPTION><br /> 127Lokacije: <OTRS_APPOINTMENT_LOCATION><br /> 128Kalendar: <span style="color: <OTRS_CALENDAR_COLOR>;">■</span> <OTRS_CALENDAR_CALENDARNAME><br /> 129Datum početka: <OTRS_APPOINTMENT_STARTTIME><br /> 130Datum kraja: <OTRS_APPOINTMENT_ENDTIME><br /> 131Celodnevno: <OTRS_APPOINTMENT_ALLDAY><br /> 132Ponavljanje: <OTRS_APPOINTMENT_RECURRING><br /> 133<br /> 134<a href="<OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentAppointmentCalendarOverview;AppointmentID=<OTRS_APPOINTMENT_APPOINTMENTID>" title="<OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentAppointmentCalendarOverview;AppointmentID=<OTRS_APPOINTMENT_APPOINTMENTID>"><OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentAppointmentCalendarOverview;AppointmentID=<OTRS_APPOINTMENT_APPOINTMENTID></a><br /> 135<br /> 136-- <OTRS_CONFIG_NotificationSenderName>', 137 'ContentType' => 'text/html', 138 'Subject' => 'Podsetnik: <OTRS_APPOINTMENT_TITLE>', 139 }, 140 }, 141 }, 142 ); 143 144 my %ValidList = $Kernel::OM->Get('Kernel::System::Valid')->ValidList(); 145 my %ValidListReverse = reverse %ValidList; 146 147 my $NotificationEventObject = $Kernel::OM->Get('Kernel::System::NotificationEvent'); 148 149 # Get all notifications of appointment type. 150 my %NotificationList = $NotificationEventObject->NotificationList( 151 Type => 'Appointment', 152 ); 153 my %NotificationListReverse = reverse %NotificationList; 154 155 NEWNOTIFICATION: 156 for my $NotificationName ( sort keys %AppointmentNotifications ) { 157 158 # Do not add new notification if one with the same name exists. 159 next NEWNOTIFICATION if $NotificationListReverse{$NotificationName}; 160 161 # Add new event notification. 162 my $ID = $NotificationEventObject->NotificationAdd( 163 Name => $NotificationName, 164 Data => $AppointmentNotifications{$NotificationName}->{Data}, 165 Message => $AppointmentNotifications{$NotificationName}->{Message}, 166 Comment => '', 167 ValidID => $ValidListReverse{valid}, 168 UserID => 1, 169 ); 170 171 return if !$ID; 172 } 173 174 return 1; 175} 176 1771; 178 179=head1 TERMS AND CONDITIONS 180 181This software is part of the OTRS project (L<https://otrs.org/>). 182 183This software comes with ABSOLUTELY NO WARRANTY. For details, see 184the enclosed file COPYING for license information (GPL). If you 185did not receive this file, see L<https://www.gnu.org/licenses/gpl-3.0.txt>. 186 187=cut 188