Kernel::System::ITSMChange::Notification - notification functions for change management
This module is managing notifications.
new()
create a notification object
use Kernel::Config;
use Kernel::System::Encode;
use Kernel::System::Log;
use Kernel::System::Main;
use Kernel::System::DB;
use Kernel::System::Time;
use Kernel::System::ITSMChange::Notification;
my $ConfigObject = Kernel::Config->new();
my $EncodeObject = Kernel::System::Encode->new(
ConfigObject => $ConfigObject,
);
my $LogObject = Kernel::System::Log->new(
ConfigObject => $ConfigObject,
EncodeObject => $EncodeObject,
);
my $MainObject = Kernel::System::Main->new(
ConfigObject => $ConfigObject,
EncodeObject => $EncodeObject,
LogObject => $LogObject,
);
my $DBObject = Kernel::System::DB->new(
ConfigObject => $ConfigObject,
EncodeObject => $EncodeObject,
LogObject => $LogObject,
MainObject => $MainObject,
);
my $TimeObject = Kernel::System::Time->new(
ConfigObject => $ConfigObject,
LogObject => $LogObject,
);
my $NotificationObject = Kernel::System::ITSMChange::Notification->new(
EncodeObject => $EncodeObject,
ConfigObject => $ConfigObject,
LogObject => $LogObject,
MainObject => $MainObject,
DBObject => $DBObject,
TimeObject => $TimeObject,
);
NotificationSend()
Send the notification to customers and/or agents.
my $Success = $NotificationObject->NotificationSend(
AgentIDs => [ 1, 2, 3, ]
CustomerIDs => [ 1, 2, 3, ],
Type => 'Change', # Change|WorkOrder
Event => 'ChangeUpdate',
Data => { %ChangeData }, # Change|WorkOrder|Link data
UserID => 123,
);
NotificationRuleGet()
Get info about a single notification rule
my $NotificationRule = $NotificationObject->NotificationRuleGet(
ID => 123,
);
returns
{
ID => 123,
Name => 'a descriptive name',
Attribute => 'ChangeTitle',
EventID => 1,
Event => 'ChangeUpdate',
ValidID => 1,
Comment => 'description what the rule does',
Rule => 'rejected',
Recipients => [ 'ChangeBuilder', 'ChangeManager', 'ChangeCABCustomers' ],
RecipientIDs => [ 2, 3, 7 ],
}
NotificationRuleAdd()
Add a notification rule. Returns the ID of the rule.
my $ID = $NotificationObject->NotificationRuleAdd(
Name => 'a descriptive name',
Attribute => 'ChangeTitle',
EventID => 1,
ValidID => 1,
Comment => 'description what the rule does',
Rule => 'rejected',
RecipientIDs => [ 2, 3, 7 ],
);
NotificationRuleUpdate()
updates an existing notification rule
my $Success = $NotificationObject->NotificationRuleUpdate(
ID => 123,
Name => 'a descriptive name',
Attribute => 'ChangeTitle',
EventID => 1,
ValidID => 1,
Comment => 'description what the rule does',
Rule => 'rejected',
RecipientIDs => [ 2, 3, 7 ],
);
NotificationRuleList()
returns an array reference with IDs of all existing notification rules
my $List = $NotificationObject->NotificationRuleList();
returns
[ 1, 2, 3 ]
NotificationRuleSearch()
Returns an array reference with IDs of all matching notification rules. The only valid search parameter is the EventID.
my $NotificationRuleIDs = $NotificationObject->NotificationRuleSearch(
EventID => 4, # optional, primary key in change_history_type
Valid => 1, # optional, default is 1
);
returns
[ 1, 2, 3 ]
RecipientLookup()
Returns the ID when you pass the recipient name and returns the name if you pass the recipient ID.
my $ID = $NotificationObject->RecipientLookup(
Name => 'ChangeBuilder',
);
my $Name = $NotificationObject->RecipientLookup(
ID => 123,
);
RecipientList()
returns an array reference with hashreferences. The key of the hashreference is the id of an recipient and the name is the value.
my $List = $NotificationObject->RecipientList();
returns
[
{
Key => 1,
Value => 'ChangeBuilder'
},
{
Key => 2,
Value => 'ChangeManager'
},
]
OTRS_CHANGE_xxx
with the subsequent values for xxx:
ChangeID
The ID of the change
ChangeNumber
The number of the change
ChangeStateID
The ID of the change state
ChangeState
The name of the change state (e.g. requested, approved)
ChangeStateSignal
ChangeTitle
The change title
Description
The "original" description. Please note: If richtext feature is enabled,
this contains HTML markup. So this can be used to send HTML notifications.
DescriptionPlain
This is the plain description without any HTML markup. This is better for plain notifications.
Justification
The same as for Description applies here.
JustificationPlain
See DescriptionPlain.
ChangeBuilderID
Change builder ID
ChangeManagerID
Change manager ID
CategoryID
ID of changes' category.
Category
Name of changes' category.
ImpactID
ID of changes' impact.
Impact
Name of changes' impact.
PriorityID
ID of changes' priority.
Priority
Name of changes' priority.
WorkOrderCount
Number of all work orders that belong to the change.
RequestedTime
The time the customer want the change to be finished.
PlannedEffort
Sum of the planned efforts (calculated from the workorders).
AccountedTime
Accounted time of the change (calculated from the workorders).
PlannedStartTime
Planned start time of the change (calculated from the workorders).
PlannedEndTime
Planned end time of the change (calculated from the workorders).
ActualStartTime
Actual start time of the change (calculated from the workorders).
ActualEndTime
Actual end time of the change (calculated from the workorders).
OTRS_CHANGEBUILDER_xxx
, OTRS_CHANGEMANAGER_xxx
, OTRS_WORKORDERAGENT_xxx
with the subsequent values for xxx:
UserFirstname
Firstname of the person.
UserLastname
Lastname of the person.
UserEmail
Email address of the person.
OTRS_WORKORDER_xxx
with the subsequent values for xxx:
WorkOrderID
ID of the workorder
ChangeID
ID of the change the workorder belongs to.
WorkOrderNumber
Workorder number
WorkOrderTitle
Title of the workorder
Instruction
See Change placeholders -> Description
InstructionPlain
See Change placeholders -> DescriptionPlain
Report
See Change placeholders -> Description
ReportPlain
See Change placeholders -> DescriptionPlain
WorkOrderStateID
ID of the workorder state.
WorkOrderState
Name of the workorder state.
WorkOrderStateSignal
WorkOrderTypeID
ID of the workorder type.
WorkOrderType
The name of the work order type.
WorkOrderAgentID
The ID of the workorder agent.
PlannedStartTime
The planned start time for the workorder.
PlannedEndTime
The planned end time for the workorder.
ActualStartTime
When did the workorder actually start.
ActualEndTime
When did the workorder actually end.
AccountedTime
The so far accounted time for the single workorder
PlannedEffort
This is the effort planned for the single workorder.
OTRS_LINK_xxx
with the subsequent values for xxx:
Object
other object of the link
SourceObject
other object of the link, when the other object is the source
TargetObject
other object of the link, when the other object ist the target
State
State of the link
Type
Type of the link
This software is part of the OTRS project (http://otrs.org/).
This software comes with ABSOLUTELY NO WARRANTY. For details, see the enclosed file COPYING for license information (AGPL). If you did not receive this file, see http://www.gnu.org/licenses/agpl.txt.