NotificationEvent#
NAME#
Kernel::System::NotificationEvent - to manage the notifications
DESCRIPTION#
All functions to manage the notification and the notification jobs.
PUBLIC INTERFACE#
new()#
Don’t use the constructor directly, use the ObjectManager instead:
my $NotificationEventObject = $Kernel::OM->Get('Kernel::System::NotificationEvent');
NotificationList()#
returns a hash of all notifications
my %List = $NotificationEventObject->NotificationList(
Type => 'Ticket', # type of notifications; default: 'Ticket'
Details => 1, # include notification detailed data. possible (0|1) # ; default: 0
All => 1, # optional: if given all notification types will be returned, even if type is given (possible: 0|1)
);
NotificationGet()#
returns a hash of the notification data
my %Notification = $NotificationEventObject->NotificationGet(
Name => 'NotificationName',
);
my %Notification = $NotificationEventObject->NotificationGet(
ID => 1,
);
Returns:
%Notification = (
ID => 123,
Name => 'Agent::Move',
Data => {
Events => [ 'TicketQueueUpdate' ],
# ...
Queue => [ 'SomeQueue' ],
},
Message => {
en => {
Subject => 'Hello',
Body => 'Hello World',
ContentType => 'text/plain',
},
de => {
Subject => 'Hallo',
Body => 'Hallo Welt',
ContentType => 'text/plain',
},
},
Comment => 'An optional comment',
ValidID => 1,
CreateTime => '2010-10-27 20:15:00',
CreateBy => 2,
ChangeTime => '2010-10-27 20:15:00',
ChangeBy => 1,
UserID => 3,
);
NotificationAdd()#
adds a new notification to the database
my $ID = $NotificationEventObject->NotificationAdd(
Name => 'Agent::OwnerUpdate',
Data => {
Events => [ 'TicketQueueUpdate' ],
# ...
Queue => [ 'SomeQueue' ],
},
Message => {
en => {
Subject => 'Hello',
Body => 'Hello World',
ContentType => 'text/plain',
},
de => {
Subject => 'Hallo',
Body => 'Hallo Welt',
ContentType => 'text/plain',
},
},
Comment => 'An optional comment', # (optional)
ValidID => 1,
UserID => 123,
);
NotificationUpdate()#
update a notification in database
my $Ok = $NotificationEventObject->NotificationUpdate(
ID => 123,
Name => 'Agent::OwnerUpdate',
Data => {
Events => [ 'TicketQueueUpdate' ],
# ...
Queue => [ 'SomeQueue' ],
},
Message => {
en => {
Subject => 'Hello',
Body => 'Hello World',
ContentType => 'text/plain',
},
de => {
Subject => 'Hallo',
Body => 'Hallo Welt',
ContentType => 'text/plain',
},
},
Comment => 'An optional comment', # (optional)
ValidID => 1,
UserID => 123,
);
NotificationDelete()#
deletes an notification from the database
$NotificationEventObject->NotificationDelete(
ID => 1,
UserID => 123,
);
NotificationEventCheck()#
returns array of notification affected by event
my @IDs = $NotificationEventObject->NotificationEventCheck(
Event => 'ArticleCreate',
);
NotificationImport()#
import an Notification YAML file/content
my $NotificationImport = $NotificationEventObject->NotificationImport(
Content => $YAMLContent, # mandatory, YAML format
OverwriteExistingNotifications => 0, # 0 || 1
UserID => 1, # mandatory
);
Returns:
$NotificationImport = {
Success => 1, # 1 if success or undef if operation could not
# be performed
Message => 'The Message to show.', # error message
AddedNotifications => 'Notification1, Notification2', # list of Notifications correctly added
UpdatedNotifications => 'Notification3, Notification4', # list of Notifications correctly updated
NotificationErrors => 'Notification5', # list of Notifications that could not be added or updated
};
NotificationBodyCheck()#
Check if body has a proper length depending on DB type.
my $Ok = $NotificationEventObject->NotificationBodyCheck(
Content => $BodyContent, # mandatory
UserID => 1, # mandatory
);