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]", $Ticket->Id, $Ticket->Subject) &>
26 <& /Ticket/Elements/Tabs,
28 current_tab => 'Ticket/Display.html?id='.$Ticket->id,
29 Title => loc("#[_1]: [_2]", $Ticket->Id, $Ticket->Subject) &>
31 <& /Elements/ListActions, actions => \@Actions &>
33 <& /Ticket/Elements/ShowSummary, Ticket => $Ticket &>
37 <& /Ticket/Elements/ShowHistory ,
39 Collapsed => $ARGS{'Collapsed'},
40 ShowHeaders => $ARGS{'ShowHeaders'} &>
51 my ($linkid, $message, $tid, $Ticket, @Actions);
53 $Ticket = new RT::Ticket($session{'CurrentUser'});
56 Abort('No ticket specified');
59 if ($ARGS{'id'} eq 'new') {
60 # {{{ Create a new ticket
62 my $Queue = new RT::Queue($session{'CurrentUser'});
63 unless ($Queue->Load($ARGS{'Queue'})) {
64 Abort('Queue not found');
67 unless ($Queue->CurrentUserHasRight('CreateTicket')) {
68 Abort('You have no permission to create tickets in that queue.');
71 CreateTicket(Attachments => $session{'Attachments'}, %ARGS);
72 delete $session{'Attachments'};
73 unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
74 Abort("No permission to view newly created ticket #".$Ticket->id.".");
80 $Ticket = LoadTicket($ARGS{'id'});
81 unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
82 Abort("No permission to view ticket");
86 if (defined $ARGS{'Action'}) {
87 if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) {
89 my ($res, $msg)=$Ticket->$action();
94 if ( $ARGS{'UpdateContent'} ) {
95 $ARGS{'UpdateContent'} =~ s/\r\n/\n/g;
96 if ( $ARGS{'UpdateContent'} ne ''
97 && $ARGS{'UpdateContent'} ne "-- \n"
98 . $session{'CurrentUser'}->UserObj->Signature ) {
99 $ARGS{UpdateAttachments} = $session{'Attachments'};
100 ProcessUpdateMessage( ARGSRef => \%ARGS,
101 Actions => \@Actions,
102 TicketObj => $Ticket );
103 delete $session{'Attachments'};
106 #Process status updates
107 my @BasicActions = ProcessTicketBasics(ARGSRef => \%ARGS, TicketObj=>$Ticket);
108 my @results = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
110 push (@Actions, @BasicActions, @results);