We successfully upgraded otrs from 3.3 to 4.0.7.
On the version 3.3 we had a PostMaster Filter called RejectDoubledConent.pm which ignores mails if a ticket already exists with the same subject and body. But now this filter don't work on the version 4.0.7.
Filter on version 3.3:
Code: Select all
# --
# Kernel/System/PostMaster/Filter/RejectDoubledContent.pm - sub part of PostMaster.pm
# Copyright (C) 2012 Perl-Services.de
# --
# $Id: NewTicketReject.pm,v 1.20 2012/11/20 15:52:12 mh Exp $
# --
# 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::RejectDoubledContent;
use strict;
use warnings;
use Kernel::System::Ticket;
use Kernel::System::Email;
use vars qw($VERSION);
$VERSION = qw($Revision: 1.20 $) [1];
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 DBObject MainObject)) {
$Self->{$_} = $Param{$_} || die "Got no $_!";
}
$Self->{TicketObject} = Kernel::System::Ticket->new(%Param);
$Self->{EmailObject} = Kernel::System::Email->new(%Param);
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
# check needed stuff
for (qw(JobConfig GetParam)) {
if ( !$Param{$_} ) {
$Self->{LogObject}->Log( Priority => 'error', Message => "Need $_!" );
return;
}
}
# Search for tickets with the same subject, sender, state
my %MailParams = %{ $Param{GetParam} || {} };
my @TicketIDs = $Self->{TicketObject}->TicketSearch(
From => $MailParams{From},
Subject => $MailParams{Subject},
StateType => ['open', 'new']
UserID => 1,
);
# ignore mail if tickets with the same params are found
if ( @TicketIDs ) {
$Param{GetParam}->{'X-OTRS-Ignore'} = 'yes';
}
return 1;
}
1;
Code: Select all
$Self->{'PostMaster::PreFilterModule'}->{'0001-DoubledContent'} = {
Module => 'Kernel::System::PostMaster::Filter::RejectDoubledContent',
};
Thanks