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

« back to all changes in this revision

Viewing changes to Kernel/Modules/AgentTicketForward.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/Modules/AgentTicketForward.pm - to forward a message
3
 
# Copyright (C) 2001-2005 Martin Edenhofer <martin+code@otrs.org>
 
3
# Copyright (C) 2001-2007 OTRS GmbH, http://otrs.org/
4
4
# --
5
 
# $Id: AgentTicketForward.pm,v 1.8 2005/08/05 10:58:59 cs Exp $
 
5
# $Id: AgentTicketForward.pm,v 1.16.2.1 2007/01/17 13:27:57 mh 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
13
13
 
14
14
use strict;
15
15
use Kernel::System::CheckItem;
16
 
use Kernel::System::StdAttachment;
17
16
use Kernel::System::State;
18
17
use Kernel::System::SystemAddress;
19
18
use Kernel::System::CustomerUser;
21
20
use Mail::Address;
22
21
 
23
22
use vars qw($VERSION);
24
 
$VERSION = '$Revision: 1.8 $';
 
23
$VERSION = '$Revision: 1.16.2.1 $';
25
24
$VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
26
25
 
27
 
# --
28
26
sub new {
29
27
    my $Type = shift;
30
28
    my %Param = @_;
42
40
 
43
41
    # check all needed objects
44
42
    foreach (qw(TicketObject ParamObject DBObject QueueObject LayoutObject
45
 
      ConfigObject LogObject)) {
 
43
        ConfigObject LogObject)
 
44
    ) {
46
45
        die "Got no $_" if (!$Self->{$_});
47
46
    }
48
47
    # some new objects
49
48
    $Self->{CustomerUserObject} = Kernel::System::CustomerUser->new(%Param);
50
49
    $Self->{CheckItemObject} = Kernel::System::CheckItem->new(%Param);
51
 
    $Self->{StdAttachmentObject} = Kernel::System::StdAttachment->new(%Param);
52
50
    $Self->{StateObject} = Kernel::System::State->new(%Param);
53
51
    $Self->{SystemAddress} = Kernel::System::SystemAddress->new(%Param);
54
52
    $Self->{UploadCachObject} = Kernel::System::Web::UploadCache->new(%Param);
55
53
    # get params
56
54
    foreach (qw(From To Cc Bcc Subject Body InReplyTo ComposeStateID ArticleTypeID
57
 
      ArticleID TimeUnits Year Month Day Hour Minute AttachmentUpload
58
 
      AttachmentDelete1 AttachmentDelete2 AttachmentDelete3 AttachmentDelete4
59
 
      AttachmentDelete5 AttachmentDelete6 AttachmentDelete7 AttachmentDelete8
60
 
      AttachmentDelete9 AttachmentDelete10 FormID)) {
 
55
        ArticleID TimeUnits Year Month Day Hour Minute AttachmentUpload
 
56
        AttachmentDelete1 AttachmentDelete2 AttachmentDelete3 AttachmentDelete4
 
57
        AttachmentDelete5 AttachmentDelete6 AttachmentDelete7 AttachmentDelete8
 
58
        AttachmentDelete9 AttachmentDelete10 AttachmentDelete11 AttachmentDelete12
 
59
        AttachmentDelete13 AttachmentDelete14 AttachmentDelete15 AttachmentDelete16
 
60
        FormID)
 
61
    ) {
61
62
        my $Value = $Self->{ParamObject}->GetParam(Param => $_);
62
63
#        $Self->{GetParam}->{$_} = defined $Value ? $Value : '';
63
 
       if (defined($Value)) {
64
 
           $Self->{GetParam}->{$_} = $Value;
65
 
       }
 
64
        if (defined($Value)) {
 
65
            $Self->{GetParam}->{$_} = $Value;
 
66
        }
66
67
    }
67
68
    # create form id
68
69
    if (!$Self->{GetParam}->{FormID}) {
69
70
        $Self->{GetParam}->{FormID} = $Self->{UploadCachObject}->FormIDCreate();
70
71
    }
71
72
 
 
73
    $Self->{Config} = $Self->{ConfigObject}->Get("Ticket::Frontend::$Self->{Action}");
 
74
 
72
75
    return $Self;
73
76
}
74
 
# --
 
77
 
75
78
sub Run {
76
79
    my $Self = shift;
77
80
    my %Param = @_;
85
88
    }
86
89
    return $Output;
87
90
}
88
 
# --
 
91
 
89
92
sub Form {
90
93
    my $Self = shift;
91
94
    my %Param = @_;
95
98
    # check needed stuff
96
99
    if (!$Self->{TicketID}) {
97
100
        return $Self->{LayoutObject}->ErrorScreen(
98
 
                Message => "Got no TicketID!",
99
 
                Comment => 'System Error!',
 
101
            Message => "Got no TicketID!",
 
102
            Comment => 'System Error!',
100
103
        );
101
104
    }
102
105
    # get ticket data
103
106
    my %Ticket = $Self->{TicketObject}->TicketGet(TicketID => $Self->{TicketID});
 
107
 
104
108
    # check permissions
105
109
    if (!$Self->{TicketObject}->Permission(
106
 
        Type => 'forward',
 
110
        Type => $Self->{Config}->{Permission},
107
111
        TicketID => $Self->{TicketID},
108
112
        UserID => $Self->{UserID})) {
109
113
        # error screen, don't show ticket
110
114
        return $Self->{LayoutObject}->NoPermission(WithHeader => 'yes');
111
115
    }
112
 
    # get lock state && write (lock) permissions
113
 
    if (!$Self->{TicketObject}->LockIsTicketLocked(TicketID => $Self->{TicketID})) {
114
 
        # set owner
115
 
        $Self->{TicketObject}->OwnerSet(
116
 
            TicketID => $Self->{TicketID},
117
 
            UserID => $Self->{UserID},
118
 
            NewUserID => $Self->{UserID},
119
 
        );
120
 
        # set lock
121
 
        if ($Self->{TicketObject}->LockSet(
122
 
            TicketID => $Self->{TicketID},
123
 
            Lock => 'lock',
124
 
            UserID => $Self->{UserID}
125
 
        )) {
126
 
            # show lock state
127
 
            $Self->{LayoutObject}->Block(
128
 
                Name => 'TicketLocked',
129
 
                Data => {
130
 
                    %Param,
131
 
                    TicketID => $Self->{TicketID},
132
 
                },
133
 
            );
134
 
        }
135
 
    }
136
 
    else {
137
 
        my ($OwnerID, $OwnerLogin) = $Self->{TicketObject}->OwnerCheck(
138
 
            TicketID => $Self->{TicketID},
139
 
        );
140
 
        if ($OwnerID != $Self->{UserID}) {
141
 
            $Output = $Self->{LayoutObject}->Header(Title => 'Error');
142
 
            $Output .= $Self->{LayoutObject}->Warning(
143
 
                Message => "Sorry, the current owner is $OwnerLogin!",
144
 
                Comment => 'Please change the owner first.',
145
 
            );
146
 
            $Output .= $Self->{LayoutObject}->Footer();
147
 
            return $Output;
 
116
    # get lock state
 
117
    if ($Self->{Config}->{RequiredLock}) {
 
118
        if (!$Self->{TicketObject}->LockIsTicketLocked(TicketID => $Self->{TicketID})) {
 
119
            # set owner
 
120
            $Self->{TicketObject}->OwnerSet(
 
121
                TicketID => $Self->{TicketID},
 
122
                UserID => $Self->{UserID},
 
123
                NewUserID => $Self->{UserID},
 
124
            );
 
125
            # set lock
 
126
            if ($Self->{TicketObject}->LockSet(
 
127
                TicketID => $Self->{TicketID},
 
128
                Lock => 'lock',
 
129
                UserID => $Self->{UserID}
 
130
            )) {
 
131
                # show lock state
 
132
                $Self->{LayoutObject}->Block(
 
133
                    Name => 'TicketLocked',
 
134
                    Data => {
 
135
                        %Param,
 
136
                        TicketID => $Self->{TicketID},
 
137
                    },
 
138
                );
 
139
            }
148
140
        }
149
141
        else {
150
 
            $Self->{LayoutObject}->Block(
151
 
                Name => 'TicketBack',
152
 
                Data => {
153
 
                    %Param,
154
 
                    TicketID => $Self->{TicketID},
155
 
                },
 
142
            my $AccessOk = $Self->{TicketObject}->OwnerCheck(
 
143
                TicketID => $Self->{TicketID},
 
144
                OwnerID => $Self->{UserID},
156
145
            );
 
146
            if (!$AccessOk) {
 
147
                my $Output = $Self->{LayoutObject}->Header();
 
148
                $Output .= $Self->{LayoutObject}->Warning(
 
149
                    Message => "Sorry, you need to be the owner to do this action!",
 
150
                    Comment => 'Please change the owner first.',
 
151
                );
 
152
                $Output .= $Self->{LayoutObject}->Footer();
 
153
                return $Output;
 
154
            }
 
155
            else {
 
156
                $Self->{LayoutObject}->Block(
 
157
                    Name => 'TicketBack',
 
158
                    Data => {
 
159
                        %Param,
 
160
                        TicketID => $Self->{TicketID},
 
161
                    },
 
162
                );
 
163
            }
157
164
        }
158
165
    }
159
166
    # get last customer article or selecte article ...
216
223
            }
217
224
            $Data{$_} =~ s/<OTRS_CUSTOMER_REALNAME>/$From/g;
218
225
        }
 
226
        # replace user staff
 
227
        my %User = $Self->{UserObject}->GetUserData(
 
228
            UserID => $Self->{UserID},
 
229
            Cached => 1,
 
230
        );
 
231
        foreach my $UserKey (keys %User) {
 
232
            if ($User{$UserKey}) {
 
233
                $Data{$_} =~ s/<OTRS_Agent_$UserKey>/$User{$UserKey}/gi;
 
234
            }
 
235
        }
 
236
        # cleanup all not needed <OTRS_TICKET_ tags
 
237
        $Data{$_} =~ s/<OTRS_Agent_.+?>/-/gi;
219
238
        # replace other needed stuff
220
239
        $Data{$_} =~ s/<OTRS_FIRST_NAME>/$Self->{UserFirstname}/g;
221
240
        $Data{$_} =~ s/<OTRS_LAST_NAME>/$Self->{UserLastname}/g;
222
 
        $Data{$_} =~ s/<OTRS_USER_ID>/$Self->{UserID}/g;
223
 
        $Data{$_} =~ s/<OTRS_USER_LOGIN>/$Self->{UserLogin}/g;
224
241
        # replace ticket data
225
242
        foreach my $TicketKey (keys %Ticket) {
226
243
            if ($Ticket{$TicketKey}) {
256
273
    # --
257
274
    my $NewLine = $Self->{ConfigObject}->Get('Ticket::Frontend::TextAreaEmail') || 75;
258
275
    $Data{Body} =~ s/(^>.+|.{4,$NewLine})(?:\s|\z)/$1\n/gm;
259
 
    $Data{Body} =~ s/\n/\n> /g;
260
 
    $Data{Body} = "\n> " . $Data{Body};
 
276
    $Data{Body} =~ s/\t/ /g;
 
277
    my $Quote = $Self->{ConfigObject}->Get('Ticket::Frontend::Quote');
 
278
    if ($Quote) {
 
279
        $Data{Body} =~ s/\n/\n$Quote /g;
 
280
        $Data{Body} = "\n$Quote " . $Data{Body};
 
281
    }
 
282
    else {
 
283
        $Data{Body} = "\n".$Data{Body};
 
284
    }
261
285
    if ($Data{Created}) {
262
286
        $Data{Body} = "Date: $Data{Created}\n".$Data{Body};
263
287
    }
290
314
    if (ref($Self->{ConfigObject}->Get('Ticket::Frontend::ArticleComposeModule')) eq 'HASH') {
291
315
        my %Jobs = %{$Self->{ConfigObject}->Get('Ticket::Frontend::ArticleComposeModule')};
292
316
        foreach my $Job (sort keys %Jobs) {
293
 
                # load module
294
 
                if ($Self->{MainObject}->Require($Jobs{$Job}->{Module})) {
295
 
                    my $Object = $Jobs{$Job}->{Module}->new(
296
 
                        %{$Self},
297
 
                        Debug => $Self->{Debug},
298
 
                    );
299
 
                    # get params
300
 
                    foreach ($Object->Option(%Data, %GetParam, Config => $Jobs{$Job})) {
301
 
                        $GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_);
302
 
                    }
303
 
                    # run module
304
 
                    $Object->Run(%Data, %GetParam, Config => $Jobs{$Job});
305
 
                    # get errors
306
 
                    %Error = (%Error, $Object->Error(%GetParam, Config => $Jobs{$Job}));
307
 
                }
308
 
                else {
309
 
                    return $Self->{LayoutObject}->FatalError();
310
 
                }
 
317
            # load module
 
318
            if ($Self->{MainObject}->Require($Jobs{$Job}->{Module})) {
 
319
                my $Object = $Jobs{$Job}->{Module}->new(
 
320
                    %{$Self},
 
321
                    Debug => $Self->{Debug},
 
322
                );
 
323
                # get params
 
324
                foreach ($Object->Option(%Data, %GetParam, Config => $Jobs{$Job})) {
 
325
                    $GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_);
 
326
                }
 
327
                # run module
 
328
                $Object->Run(%Data, %GetParam, Config => $Jobs{$Job});
 
329
                # get errors
 
330
                %Error = (%Error, $Object->Error(%GetParam, Config => $Jobs{$Job}));
 
331
            }
 
332
            else {
 
333
                return $Self->{LayoutObject}->FatalError();
 
334
            }
311
335
        }
312
336
    }
313
337
    # get free text config options
314
338
    my %TicketFreeText = ();
315
 
    foreach (1..8) {
 
339
    foreach (1..16) {
316
340
        $TicketFreeText{"TicketFreeKey$_"} = $Self->{TicketObject}->TicketFreeTextGet(
317
341
            TicketID => $Self->{TicketID},
318
342
            Type => "TicketFreeKey$_",
330
354
        Ticket => \%Ticket,
331
355
        Config => \%TicketFreeText,
332
356
    );
 
357
    # get ticket free text params
 
358
    foreach (1..2) {
 
359
        foreach my $Type (qw(Year Month Day Hour Minute)) {
 
360
            $GetParam{"TicketFreeTime".$_.$Type} =  $Self->{ParamObject}->GetParam(Param => "TicketFreeTime".$_.$Type);
 
361
        }
 
362
    }
 
363
    # get free text params
 
364
    my %TicketFreeTime = ();
 
365
    foreach (1..2) {
 
366
        if ($Ticket{"TicketFreeTime".$_}) {
 
367
            ($TicketFreeTime{"TicketFreeTime".$_.'Secunde'}, $TicketFreeTime{"TicketFreeTime".$_.'Minute'}, $TicketFreeTime{"TicketFreeTime".$_.'Hour'}, $TicketFreeTime{"TicketFreeTime".$_.'Day'}, $TicketFreeTime{"TicketFreeTime".$_.'Month'},  $TicketFreeTime{"TicketFreeTime".$_.'Year'}) = $Self->{TimeObject}->SystemTime2Date(
 
368
                SystemTime => $Self->{TimeObject}->TimeStamp2SystemTime(
 
369
                    String => $Ticket{"TicketFreeTime".$_},
 
370
                ),
 
371
            );
 
372
        }
 
373
    }
 
374
    # free time
 
375
    my %TicketFreeTimeHTML = $Self->{LayoutObject}->AgentFreeDate(
 
376
        Ticket => \%TicketFreeTime,
 
377
    );
333
378
    # build view ...
334
379
    # start with page ...
335
380
    $Output .= $Self->{LayoutObject}->Header(Value => $Ticket{TicketNumber});
343
388
        %Data,
344
389
        %GetParam,
345
390
        %TicketFreeTextHTML,
 
391
        %TicketFreeTime,
346
392
    );
347
393
    $Output .= $Self->{LayoutObject}->Footer();
348
394
 
349
395
    return $Output;
350
396
}
351
 
# --
 
397
 
352
398
sub SendEmail {
353
399
    my $Self = shift;
354
400
    my %Param = @_;
368
414
        }
369
415
    }
370
416
    # attachment delete
371
 
    foreach (1..10) {
 
417
    foreach (1..16) {
372
418
        if ($GetParam{"AttachmentDelete$_"}) {
373
419
            $Error{AttachmentDelete} = 1;
374
420
            $Self->{UploadCachObject}->FormIDRemoveFile(
403
449
            }
404
450
        }
405
451
    }
406
 
    # --
407
 
    # get std attachment ids
408
 
    # --
409
 
    my @StdAttachmentIDs = $Self->{ParamObject}->GetArray(Param => 'StdAttachmentID');
410
452
    # prepare subject
411
453
    my $Tn = $Self->{TicketObject}->TicketNumberLookup(TicketID => $Self->{TicketID});
412
454
    $GetParam{Subject} = $Self->{TicketObject}->TicketSubjectBuild(
420
462
    }
421
463
    # prepare free text
422
464
    my %TicketFree = ();
423
 
    foreach (1..8) {
 
465
    foreach (1..16) {
424
466
        $TicketFree{"TicketFreeKey$_"} =  $Self->{ParamObject}->GetParam(Param => "TicketFreeKey$_");
425
467
        $TicketFree{"TicketFreeText$_"} =  $Self->{ParamObject}->GetParam(Param => "TicketFreeText$_");
426
468
    }
427
469
    # get free text config options
428
470
    my %TicketFreeText = ();
429
 
    foreach (1..8) {
 
471
    foreach (1..16) {
430
472
        $TicketFreeText{"TicketFreeKey$_"} = $Self->{TicketObject}->TicketFreeTextGet(
431
473
            TicketID => $Self->{TicketID},
432
474
            Type => "TicketFreeKey$_",
444
486
        Config => \%TicketFreeText,
445
487
        Ticket => \%TicketFree,
446
488
    );
 
489
    # get ticket free text params
 
490
    foreach (1..2) {
 
491
        foreach my $Type (qw(Year Month Day Hour Minute)) {
 
492
            $GetParam{"TicketFreeTime".$_.$Type} =  $Self->{ParamObject}->GetParam(Param => "TicketFreeTime".$_.$Type);
 
493
        }
 
494
    }
 
495
    my %TicketFreeTimeHTML = $Self->{LayoutObject}->AgentFreeDate(
 
496
        Ticket => \%GetParam,
 
497
    );
447
498
    # --
448
499
    # check some values
449
500
    # --
459
510
            }
460
511
        }
461
512
    }
462
 
 
463
513
    my %ArticleParam = ();
464
 
        # run compose modules
465
 
        if (ref($Self->{ConfigObject}->Get('Ticket::Frontend::ArticleComposeModule')) eq 'HASH') {
466
 
            my %Jobs = %{$Self->{ConfigObject}->Get('Ticket::Frontend::ArticleComposeModule')};
467
 
            foreach my $Job (sort keys %Jobs) {
468
 
                # load module
469
 
                if ($Self->{MainObject}->Require($Jobs{$Job}->{Module})) {
470
 
                    my $Object = $Jobs{$Job}->{Module}->new(
471
 
                        %{$Self},
472
 
                        Debug => $Self->{Debug},
473
 
                    );
474
 
                    # get params
475
 
                    foreach ($Object->Option(%GetParam, Config => $Jobs{$Job})) {
476
 
                        $GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_);
477
 
                    }
478
 
                    # run module
479
 
                    $Object->Run(%GetParam, Config => $Jobs{$Job});
480
 
                    # ticket params
481
 
                    %ArticleParam = (%ArticleParam, $Object->ArticleOption(%GetParam, Config => $Jobs{$Job}));
482
 
                    # get errors
483
 
                    %Error = (%Error, $Object->Error(%GetParam, Config => $Jobs{$Job}));
484
 
                }
485
 
                else {
486
 
                    return $Self->{LayoutObject}->FatalError();
487
 
                }
 
514
    # run compose modules
 
515
    if (ref($Self->{ConfigObject}->Get('Ticket::Frontend::ArticleComposeModule')) eq 'HASH') {
 
516
        my %Jobs = %{$Self->{ConfigObject}->Get('Ticket::Frontend::ArticleComposeModule')};
 
517
        foreach my $Job (sort keys %Jobs) {
 
518
            # load module
 
519
            if ($Self->{MainObject}->Require($Jobs{$Job}->{Module})) {
 
520
                my $Object = $Jobs{$Job}->{Module}->new(
 
521
                    %{$Self},
 
522
                    Debug => $Self->{Debug},
 
523
                );
 
524
                # get params
 
525
                foreach ($Object->Option(%GetParam, Config => $Jobs{$Job})) {
 
526
                    $GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_);
 
527
                }
 
528
                # run module
 
529
                $Object->Run(%GetParam, Config => $Jobs{$Job});
 
530
                # ticket params
 
531
                %ArticleParam = (%ArticleParam, $Object->ArticleOption(%GetParam, Config => $Jobs{$Job}));
 
532
                # get errors
 
533
                %Error = (%Error, $Object->Error(%GetParam, Config => $Jobs{$Job}));
 
534
            }
 
535
            else {
 
536
                return $Self->{LayoutObject}->FatalError();
488
537
            }
489
538
        }
 
539
    }
490
540
    # --
491
541
    # check if there is an error
492
542
    # --
498
548
            TicketID => $Self->{TicketID},
499
549
            QueueID => $QueueID,
500
550
            NextStates => $Self->_GetNextStates(),
501
 
            NextState => $NextState,
502
551
            Errors => \%Error,
503
552
            Attachments => \@Attachments,
504
553
            %TicketFreeTextHTML,
 
554
            %TicketFreeTimeHTML,
505
555
            %GetParam,
506
556
        );
507
557
        $Output .= $Self->{LayoutObject}->Footer();
541
591
        Charset => $Self->{LayoutObject}->{UserCharset},
542
592
        Type => 'text/plain',
543
593
        Attachment => \@AttachmentData,
544
 
        StdAttachmentIDs => \@StdAttachmentIDs,
545
594
        %ArticleParam,
546
595
    )) {
547
596
        # time accounting
554
603
            );
555
604
        }
556
605
        # update ticket free text
557
 
        foreach (1..8) {
 
606
        foreach (1..16) {
558
607
            my $FreeKey = $Self->{ParamObject}->GetParam(Param => "TicketFreeKey$_");
559
608
            my $FreeValue = $Self->{ParamObject}->GetParam(Param => "TicketFreeText$_");
560
609
            if (defined($FreeKey) && defined($FreeValue)) {
567
616
                );
568
617
            }
569
618
        }
 
619
        # set ticket free time
 
620
        foreach (1..2) {
 
621
            if (defined($GetParam{"TicketFreeTime".$_."Year"}) &&
 
622
                defined($GetParam{"TicketFreeTime".$_."Month"}) &&
 
623
                defined($GetParam{"TicketFreeTime".$_."Day"}) &&
 
624
                defined($GetParam{"TicketFreeTime".$_."Hour"}) &&
 
625
                defined($GetParam{"TicketFreeTime".$_."Minute"})) {
 
626
                my %Time = $Self->{LayoutObject}->TransfromDateSelection(
 
627
                    %GetParam,
 
628
                    Prefix => "TicketFreeTime".$_,
 
629
                );
 
630
                $Self->{TicketObject}->TicketFreeTimeSet(
 
631
                    %Time,
 
632
                    Prefix => "TicketFreeTime",
 
633
                    TicketID => $Self->{TicketID},
 
634
                    Counter => $_,
 
635
                    UserID => $Self->{UserID},
 
636
                );
 
637
            }
 
638
        }
570
639
        # set state
571
640
        $Self->{TicketObject}->StateSet(
572
641
            TicketID => $Self->{TicketID},
605
674
        }
606
675
    }
607
676
    else {
608
 
      # error page
609
 
      return $Self->{LayoutObject}->ErrorScreen(
610
 
          Comment => 'Please contact the admin.',
611
 
      );
 
677
        # error page
 
678
        return $Self->{LayoutObject}->ErrorScreen(
 
679
            Comment => 'Please contact the admin.',
 
680
        );
612
681
    }
613
682
}
614
 
# --
 
683
 
615
684
sub _GetNextStates {
616
685
    my $Self = shift;
617
686
    my %Param = @_;
618
687
    # get next states
619
688
    my %NextStates = $Self->{TicketObject}->StateList(
620
 
        Type => 'DefaultNextForward',
621
689
        Action => $Self->{Action},
622
690
        TicketID => $Self->{TicketID},
623
691
        UserID => $Self->{UserID},
624
692
    );
625
693
    return \%NextStates;
626
694
}
627
 
# --
 
695
 
628
696
sub _Mask {
629
697
    my $Self = shift;
630
698
    my %Param = @_;
631
699
    # build next states string
 
700
    my %State = ();
 
701
    if (!$Param{ComposeStateID}) {
 
702
        $State{Selected} = $Self->{Config}->{StateDefault};
 
703
    }
 
704
    else {
 
705
        $State{SelectedID} = $Param{ComposeStateID};
 
706
    }
 
707
 
632
708
    $Param{'NextStatesStrg'} = $Self->{LayoutObject}->OptionStrgHashRef(
633
709
        Data => $Param{NextStates},
634
710
        Name => 'ComposeStateID',
635
 
        Selected => $Param{NextState}
 
711
        %State,
636
712
    );
637
713
    my %ArticleTypes = ();
638
 
    my @ArticleTypesPossible = @{$Self->{ConfigObject}->Get('Ticket::Frontend::ForwardArticleTypes')};
 
714
    my @ArticleTypesPossible = @{$Self->{Config}->{ArticleTypes}};
639
715
    foreach (@ArticleTypesPossible) {
640
716
        $ArticleTypes{$Self->{TicketObject}->ArticleTypeLookup(ArticleType => $_)} = $_;
641
717
    }
650
726
        $Param{'ArticleTypesStrg'} = $Self->{LayoutObject}->OptionStrgHashRef(
651
727
            Data => \%ArticleTypes,
652
728
            Name => 'ArticleTypeID',
653
 
            Selected => $Self->{ConfigObject}->Get('Ticket::Frontend::ForwardArticleType'),
 
729
            Selected => $Self->{Config}->{ArticleTypeDefault},
654
730
        );
655
731
    }
656
732
 
666
742
        Format => 'DateInputFormatLong',
667
743
        DiffTime => $Self->{ConfigObject}->Get('Ticket::Frontend::PendingDiffTime') || 0,
668
744
    );
 
745
    # ticket free text
 
746
    my $Count = 0;
 
747
    foreach (1..16) {
 
748
        $Count++;
 
749
        if ($Self->{Config}->{'TicketFreeText'}->{$Count}) {
 
750
            $Self->{LayoutObject}->Block(
 
751
                Name => 'FreeText',
 
752
                Data => {
 
753
                    TicketFreeKeyField => $Param{'TicketFreeKeyField'.$Count},
 
754
                    TicketFreeTextField => $Param{'TicketFreeTextField'.$Count},
 
755
                },
 
756
            );
 
757
        }
 
758
    }
 
759
    $Count = 0;
 
760
    foreach (1..2) {
 
761
        $Count++;
 
762
        if ($Self->{Config}->{'TicketFreeTime'}->{$Count}) {
 
763
            $Self->{LayoutObject}->Block(
 
764
                Name => 'FreeTime',
 
765
                Data => {
 
766
                    TicketFreeTimeKey => $Self->{ConfigObject}->Get('TicketFreeTimeKey'.$Count),
 
767
                    TicketFreeTime => $Param{'TicketFreeTime'.$Count},
 
768
                    Count => $Count,
 
769
                },
 
770
            );
 
771
        }
 
772
    }
669
773
    # show time accounting box
670
774
    if ($Self->{ConfigObject}->Get('Ticket::Frontend::AccountTime')) {
671
775
        $Self->{LayoutObject}->Block(
678
782
        );
679
783
    }
680
784
    # show spell check
681
 
    if ($Self->{ConfigObject}->Get('SpellChecker')) {
 
785
    if ($Self->{ConfigObject}->Get('SpellChecker') && $Self->{LayoutObject}->{BrowserJavaScriptSupport}) {
682
786
        $Self->{LayoutObject}->Block(
683
787
            Name => 'SpellCheck',
684
788
            Data => {},
685
789
        );
686
790
    }
 
791
    # show address book
 
792
    if ($Self->{LayoutObject}->{BrowserJavaScriptSupport}) {
 
793
        $Self->{LayoutObject}->Block(
 
794
            Name => 'AddressBook',
 
795
            Data => {},
 
796
        );
 
797
    }
687
798
    # show attachments
688
799
    foreach my $DataRef (@{$Param{Attachments}}) {
689
800
        $Self->{LayoutObject}->Block(
694
805
    # create & return output
695
806
    return $Self->{LayoutObject}->Output(TemplateFile => 'AgentTicketForward', Data => \%Param);
696
807
}
697
 
# --
 
808
 
698
809
1;