Easy enough:
OOO.xml place in Kernel/Config/Files:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<otrs_config version="1.0" init="Application">
<ConfigItem Name="PostMaster::PreFilterModule###111-OoO" Required="0" Valid="0">
<Description Translatable="1">Module to Allow Out of Office to not change state.</Description>
<Group>Ticket</Group>
<SubGroup>Core::PostMaster</SubGroup>
<Setting>
<Hash>
<Item Key="Module">Kernel::System::PostMaster::Filter::OutOfOffice</Item>
<Item Key="OutOfOfficeString">Out of Office</Item>
</Hash>
</Setting>
</ConfigItem>
</otrs_config>
Code: Select all
# --
# 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.
# --
package Kernel::System::PostMaster::Filter::OutOfOffice;
use strict;
use warnings;
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
$Self->{Debug} = $Param{Debug} || 0;
# get needed objects
for (qw(ConfigObject LogObject MainObject TicketObject)) {
$Self->{$_} = $Param{$_} || die "Got no $_!";
}
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
# check needed stuff
for (qw(JobConfig GetParam)) {
if ( !$Param{$_} ) {
$Self->{LogObject}->Log( Priority => 'error', Message => "Need $_!" );
return;
}
}
# get config options
my %Config;
my $OOOString;
if ( $Param{JobConfig} && ref( $Param{JobConfig} ) eq 'HASH' ) {
%Config = %{ $Param{JobConfig} };
if ( $Config{OutOfOfficeString} ) {
$OOOString = $Config{OutOfOfficeString};
} else {
$Self->{LogObject}->Log(
'Priority' => 'error',
'Message' => 'Need Out of Office String to parse!',
);
return;
}
}
if ( !$Param{TicketID} ) {
# no TicketID, not a followup
return 1;
}
my %Ticket = $Self->{TicketObject}->TicketGet(
TicketID => $Param{TicketID},
UserID => 1
);
if ( $Param{GetParam}->{'Subject'} =~ /$OOOString/i) {
$Param{GetParam}->{'X-OTRS-FollowUp-State'} = $Ticket{State};
}
return 1;
}
1;