~ubuntu-branches/ubuntu/natty/otrs2/natty-updates

« back to all changes in this revision

Viewing changes to Kernel/System/PostMaster/Reject.pm

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2007-04-14 17:58:55 UTC
  • mto: (20.1.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: package-import@ubuntu.com-20070414175855-9ne0w01yu1q44ch0
Tags: upstream-2.1.7
ImportĀ upstreamĀ versionĀ 2.1.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# --
2
2
# Kernel/System/PostMaster/Reject.pm - the sub part of PostMaster.pm
3
 
# Copyright (C) 2001-2004 Martin Edenhofer <martin+code@otrs.org>
 
3
# Copyright (C) 2001-2006 OTRS GmbH, http://otrs.org/
4
4
# --
5
 
# $Id: Reject.pm,v 1.1 2004/11/26 10:57:03 martin Exp $
 
5
# $Id: Reject.pm,v 1.6 2006/11/02 13:02:04 tr Exp $
6
6
# --
7
7
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
8
8
# the enclosed file COPYING for license information (GPL). If you
14
14
use strict;
15
15
 
16
16
use vars qw($VERSION);
17
 
$VERSION = '$Revision: 1.1 $';
 
17
$VERSION = '$Revision: 1.6 $';
18
18
$VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
19
19
 
20
 
# --
21
20
sub new {
22
21
    my $Type = shift;
23
22
    my %Param = @_;
39
38
 
40
39
    return $Self;
41
40
}
42
 
# --
 
41
 
43
42
sub Run {
44
43
    my $Self = shift;
45
44
    my %Param = @_;
46
 
    # --
 
45
 
47
46
    # check needed stuff
48
 
    # --
49
47
    foreach (qw(TicketID InmailUserID GetParam Tn AutoResponseType)) {
50
 
      if (!$Param{$_}) {
51
 
        $Self->{LogObject}->Log(Priority => 'error', Message => "Need $_!");
52
 
        return;
53
 
      }
 
48
        if (!$Param{$_}) {
 
49
            $Self->{LogObject}->Log(Priority => 'error', Message => "Need $_!");
 
50
            return;
 
51
        }
54
52
    }
55
53
    my %GetParam = %{$Param{GetParam}};
56
54
    # get ticket data
57
55
    my %Ticket = $Self->{TicketObject}->TicketGet(TicketID => $Param{TicketID});
58
56
 
59
 
        my $Comment = $Param{Comment} || '';
 
57
    my $Comment = $Param{Comment} || '';
60
58
    my $Lock = $Param{Lock} || '';
61
59
    my $AutoResponseType = $Param{AutoResponseType} || '';
62
60
 
80
78
        AutoResponseType => $AutoResponseType,
81
79
        OrigHeader => \%GetParam,
82
80
    );
83
 
    # --
 
81
    if (!$ArticleID) {
 
82
        return;
 
83
    }
 
84
 
84
85
    # debug
85
 
    # --
86
86
    if ($Self->{Debug} > 0) {
87
87
        print "Reject Follow up Ticket\n";
88
88
        print "TicketNumber: $Param{Tn}\n";
95
95
        print "SenderType: $GetParam{'X-OTRS-SenderType'}\n";
96
96
        print "ArticleType: $GetParam{'X-OTRS-ArticleType'}\n";
97
97
    }
98
 
    # --
 
98
 
99
99
    # write plain email to the storage
100
 
    # --
101
100
    $Self->{TicketObject}->ArticleWritePlain(
102
101
        ArticleID => $ArticleID,
103
102
        Email => $Self->{ParseObject}->GetPlainEmail(),
104
103
        UserID => $Param{InmailUserID},
105
104
    );
106
 
    # --
 
105
 
107
106
    # write attachments to the storage
108
 
    # --
109
107
    foreach my $Attachment ($Self->{ParseObject}->GetAttachments()) {
110
108
        $Self->{TicketObject}->ArticleWriteAttachment(
111
109
            Content => $Attachment->{Content},
115
113
            UserID => $Param{InmailUserID},
116
114
        );
117
115
    }
118
 
    # --
 
116
 
119
117
    # set free article text
120
 
    # --
121
 
    my @Values = ('X-OTRS-ArticleKey', 'X-OTRS-ArticleValue');
 
118
    my @Values = ('X-OTRS-FollowUp-ArticleKey', 'X-OTRS-FollowUp-ArticleValue');
122
119
    my $CounterTmp = 0;
123
120
    while ($CounterTmp <= 3) {
124
121
        $CounterTmp++;
125
122
        if ($GetParam{"$Values[0]$CounterTmp"}) {
126
123
            $Self->{TicketObject}->ArticleFreeTextSet(
 
124
                TicketID => $Param{TicketID},
127
125
                ArticleID => $ArticleID,
128
126
                Key => $GetParam{"$Values[0]$CounterTmp"},
129
127
                Value => $GetParam{"$Values[1]$CounterTmp"},
146
144
 
147
145
    return 1;
148
146
}
149
 
# --
 
147
 
150
148
1;