Skip to content

Commit

Permalink
Fixed migration of mention notification.
Browse files Browse the repository at this point in the history
  • Loading branch information
jepf committed Jan 25, 2024
1 parent 7a7d4d5 commit 0243614
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# 7.0.15 2024-??-??
- 2024-01-25 Fixed migration of mention notification.
- 2024-01-18 Exchanged CKEditor 4.22.1 source version with minified version to improve browser loading times. [#535](https://github.com/znuny/Znuny/issues/533)
- 2024-01-15 Updated Transition Action Default Parameters.
- 2024-01-11 Fixed appointment notifications not being sent if crypting/signing options were configured.
Expand Down
18 changes: 5 additions & 13 deletions scripts/Migration/Znuny/MigrateNotificationEvents.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ package scripts::Migration::Znuny::MigrateNotificationEvents; ## no critic

use strict;
use warnings;

use utf8;

use parent qw(scripts::Migration::Base);

use Kernel::System::VariableCheck qw(:all);

our @ObjectDependencies = (
'Kernel::System::HTMLUtils',
'Kernel::System::NotificationEvent',
);

Expand Down Expand Up @@ -95,7 +95,6 @@ sub _MigrateMentionNotification {
my ( $Self, %Param ) = @_;

my $NotificationEventObject = $Kernel::OM->Get('Kernel::System::NotificationEvent');
my $HTMLUtilsObject = $Kernel::OM->Get('Kernel::System::HTMLUtils');

my %NotificationEvents = $NotificationEventObject->NotificationList(

Expand All @@ -114,22 +113,19 @@ sub _MigrateMentionNotification {
next NOTIFICATIONEVENTID if !$NotificationEventsToUpdateByName{ $NotificationEvent->{Name} };

if ( IsHashRefWithData( $NotificationEvent->{Message}->{en} ) ) {
$NotificationEvent->{Message}->{en}->{Body} = 'Hi <OTRS_NOTIFICATION_RECIPIENT_UserFirstname>,
$NotificationEvent->{Message}->{en}->{ContentType} = 'text/plain';
$NotificationEvent->{Message}->{en}->{Body} = 'Hi <OTRS_NOTIFICATION_RECIPIENT_UserFirstname>,
you have been mentioned in ticket <OTRS_TICKET_NUMBER>.
<OTRS_AGENT_BODY[5]>
<OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentTicketZoom;TicketID=<OTRS_TICKET_TicketID>
-- <OTRS_CONFIG_NotificationSenderName>';

$NotificationEvent->{Message}->{en}->{Body} = $HTMLUtilsObject->ToHTML(
String => $NotificationEvent->{Message}->{en}->{Body},
ReplaceDoubleSpace => 0,
);
}

if ( IsHashRefWithData( $NotificationEvent->{Message}->{de} ) ) {
$NotificationEvent->{Message}->{de}->{ContentType} = 'text/plain';
$NotificationEvent->{Message}->{de}->{Body}
= 'Hallo <OTRS_NOTIFICATION_RECIPIENT_UserFirstname> <OTRS_NOTIFICATION_RECIPIENT_UserLastname>,
Expand All @@ -139,11 +135,6 @@ Sie wurden erwähnt in Ticket <OTRS_TICKET_NUMBER>.
<OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>index.pl?Action=AgentTicketZoom;TicketID=<OTRS_TICKET_TicketID>
-- <OTRS_CONFIG_NotificationSenderName>';

$NotificationEvent->{Message}->{de}->{Body} = $HTMLUtilsObject->ToHTML(
String => $NotificationEvent->{Message}->{de}->{Body},
ReplaceDoubleSpace => 0,
);
}

my $NotificationEventUpdated = $NotificationEventObject->NotificationUpdate(
Expand All @@ -153,6 +144,7 @@ Sie wurden erwähnt in Ticket <OTRS_TICKET_NUMBER>.
next NOTIFICATIONEVENTID if $NotificationEventUpdated;

print " Error updating notification event with ID $NotificationEventID.\n";
return;
}

return 1;
Expand Down

0 comments on commit 0243614

Please sign in to comment.