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, Attachments => $attachments &>
37 <& /Ticket/Elements/ShowHistory ,
39 Collapsed => $ARGS{'Collapsed'},
40 ShowHeaders => $ARGS{'ShowHeaders'},
41 Attachments => $attachments,
42 AttachmentContent => $attachment_content
56 my ($linkid, $message, $tid, @Actions);
58 unless ($id || $TicketObj) {
59 Abort('No ticket specified');
62 if ($ARGS{'id'} eq 'new') {
63 # {{{ Create a new ticket
65 my $Queue = new RT::Queue($session{'CurrentUser'});
66 unless ($Queue->Load($ARGS{'Queue'})) {
67 Abort('Queue not found');
70 unless ($Queue->CurrentUserHasRight('CreateTicket')) {
71 Abort('You have no permission to create tickets in that queue.');
73 ($TicketObj, @Actions) =
74 CreateTicket(Attachments => $session{'Attachments'}, %ARGS);
75 delete $session{'Attachments'};
76 unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
77 Abort("No permission to view newly created ticket #".$TicketObj->id.".");
83 $TicketObj = RT::Ticket->new($session{'CurrentUser'});
85 $TicketObj = LoadTicket($ARGS{'id'});
86 unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
87 Abort("No permission to view ticket");
91 if (defined $ARGS{'Action'}) {
92 if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) {
94 my ($res, $msg)=$TicketObj->$action();
99 $ARGS{'UpdateContent'} =~ s/\r\n/\n/g;
100 if ( $ARGS{'UpdateTimeWorked'} ||
101 $session{'Attachments'} ||
102 ( $ARGS{'UpdateContent'} ne ''
103 && $ARGS{'UpdateContent'} ne "-- \n"
104 . $session{'CurrentUser'}->UserObj->Signature )) {
105 $ARGS{UpdateAttachments} = $session{'Attachments'};
106 ProcessUpdateMessage( ARGSRef => \%ARGS,
107 Actions => \@Actions,
108 TicketObj => $TicketObj );
109 delete $session{'Attachments'};
111 #Process status updates
112 my @BasicActions = ProcessTicketBasics(ARGSRef => \%ARGS, TicketObj=>$TicketObj);
113 my @results = ProcessTicketLinks( TicketObj => $TicketObj, ARGSRef => \%ARGS);
115 push (@Actions, @BasicActions, @results);
118 my $attachments = $m->comp('Elements/FindAttachments', Ticket => $TicketObj);
119 my $attachment_content = $m->comp('Elements/LoadTextAttachments', Ticket => $TicketObj);