3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
5 %# (Except where explictly superceded by other copyright notices)
7 %# This work is made available to you under the terms of Version 2 of
8 %# the GNU General Public License. A copy of that license should have
9 %# been provided with this software, but in any event can be snarfed
12 %# This work is distributed in the hope that it will be useful, but
13 %# WITHOUT ANY WARRANTY; without even the implied warranty of
14 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 %# General Public License for more details.
17 %# Unless otherwise specified, all modifications, corrections or
18 %# extensions to this work which alter its source code become the
19 %# property of Best Practical Solutions, LLC when submitted for
20 %# inclusion in the work.
25 Title => loc("#[_1]: [_2]", $TicketObj->Id, $TicketObj->Subject) &>
26 <& /Ticket/Elements/Tabs,
28 current_tab => 'Ticket/Display.html?id='.$TicketObj->id,
29 Title => loc("#[_1]: [_2]", $TicketObj->Id, $TicketObj->Subject) &>
31 <& /Elements/ListActions, actions => \@Actions &>
33 <& /Ticket/Elements/ShowSummary, Ticket => $TicketObj &>
37 <& /Ticket/Elements/ShowHistory ,
39 Collapsed => $ARGS{'Collapsed'},
40 ShowHeaders => $ARGS{'ShowHeaders'} &>
52 my ($linkid, $message, $tid, @Actions);
54 unless ($id || $TicketObj) {
55 Abort('No ticket specified');
58 if ($ARGS{'id'} eq 'new') {
59 # {{{ Create a new ticket
61 my $Queue = new RT::Queue($session{'CurrentUser'});
62 unless ($Queue->Load($ARGS{'Queue'})) {
63 Abort('Queue not found');
66 unless ($Queue->CurrentUserHasRight('CreateTicket')) {
67 Abort('You have no permission to create tickets in that queue.');
69 ($TicketObj, @Actions) =
70 CreateTicket(Attachments => $session{'Attachments'}, %ARGS);
71 delete $session{'Attachments'};
72 unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
73 Abort("No permission to view newly created ticket #".$TicketObj->id.".");
79 $TicketObj = RT::Ticket->new($session{'CurrentUser'});
81 $TicketObj = LoadTicket($ARGS{'id'});
82 unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
83 Abort("No permission to view ticket");
87 if (defined $ARGS{'Action'}) {
88 if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) {
90 my ($res, $msg)=$TicketObj->$action();
95 if ( $ARGS{'UpdateContent'} || $session{'Attachments'}) {
96 $ARGS{'UpdateContent'} =~ s/\r\n/\n/g;
97 if ( $session{'Attachments'} ||
98 ( $ARGS{'UpdateContent'} ne ''
99 && $ARGS{'UpdateContent'} ne "-- \n"
100 . $session{'CurrentUser'}->UserObj->Signature )) {
101 $ARGS{UpdateAttachments} = $session{'Attachments'};
102 ProcessUpdateMessage( ARGSRef => \%ARGS,
103 Actions => \@Actions,
104 TicketObj => $TicketObj );
105 delete $session{'Attachments'};
108 #Process status updates
109 my @BasicActions = ProcessTicketBasics(ARGSRef => \%ARGS, TicketObj=>$TicketObj);
110 my @results = ProcessTicketLinks( TicketObj => $TicketObj, ARGSRef => \%ARGS);
112 push (@Actions, @BasicActions, @results);