1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
6 %# <jesse@bestpractical.com>
8 %# (Except where explicitly superseded by other copyright notices)
13 %# This work is made available to you under the terms of Version 2 of
14 %# the GNU General Public License. A copy of that license should have
15 %# been provided with this software, but in any event can be snarfed
18 %# This work is distributed in the hope that it will be useful, but
19 %# WITHOUT ANY WARRANTY; without even the implied warranty of
20 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 %# General Public License for more details.
23 %# You should have received a copy of the GNU General Public License
24 %# along with this program; if not, write to the Free Software
25 %# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 %# CONTRIBUTION SUBMISSION POLICY:
30 %# (The following paragraph is not intended to limit the rights granted
31 %# to you to modify and distribute this software under the terms of
32 %# the GNU General Public License and is only of importance to you if
33 %# you choose to contribute your changes and enhancements to the
34 %# community by submitting them to Best Practical Solutions, LLC.)
36 %# By intentionally submitting any modifications, corrections or
37 %# derivatives to this work, or any other work intended for use with
38 %# Request Tracker, to Best Practical Solutions, LLC, you confirm that
39 %# you are the copyright holder for those contributions and you grant
40 %# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
41 %# royalty-free, perpetual, license to use, copy, create derivative
42 %# works based on those contributions, and sublicense and distribute
43 %# those contributions and any derivatives thereof.
45 %# END BPS TAGGED BLOCK }}}
46 <& /SelfService/Elements/Header, Title => loc('#[_1]: [_2]', $Ticket->id, $Ticket->Subject) &>
48 <& /Elements/ListActions, actions => \@results &>
50 <TABLE WIDTH="100%" class="ticketsummary" >
52 <TD VALIGN=TOP WIDTH="50%" class="boxcontainer">
53 <& /Elements/TitleBoxStart, title => loc('The Basics'),
54 title_class=> 'inverse',
56 <& /Ticket/Elements/ShowBasics, Ticket => $Ticket &>
57 <& /Ticket/Elements/ShowCustomFields, Ticket => $Ticket &>
58 <& /Elements/TitleBoxEnd &>
60 <TD VALIGN=TOP WIDTH="50%" class="boxcontainer">
61 <& /Elements/TitleBoxStart, title => loc("Dates"),
62 title_class=> 'inverse',
64 <& /Ticket/Elements/ShowDates, Ticket => $Ticket, UpdatedLink => 0 &>
65 <& /Elements/TitleBoxEnd &>
72 %#!!pape: selfservice_find_attachments.patch {{
73 <& /Ticket/Elements/ShowHistory,
75 URIFile => "Display.html",
76 ShowHeaders => $ARGS{'ShowHeaders'},
77 AttachPath => "Attachment",
78 Attachments => $attachments,
79 UpdatePath => "Update.html"
81 %#!!pape: selfservice_find_attachments.patch }}
87 my ( $field, @results );
90 #If we get handed two ids, mason will make them an array. bleck.
91 # We want teh first one. Just because there's no other sensible way
93 my @id = ( ref $id eq 'ARRAY' ) ? @{$id} : ($id);
95 my $Ticket = new RT::Ticket( $session{'CurrentUser'} );
97 # store the uploaded attachment in session
98 if ( $ARGS{'Attach'} ) { # attachment?
99 $session{'Attachments'} = {} unless defined $session{'Attachments'};
101 my $subject = "$ARGS{'Attach'}";
103 # since CGI.pm deutf8izes the magic field, we need to add it back.
104 Encode::_utf8_on($subject);
106 # strip leading directories
107 $subject =~ s#^.*[\\/]##;
109 my $attachment = MakeMIMEEntity(
112 AttachmentFieldName => 'Attach'
115 $session{'Attachments'} =
116 { %{ $session{'Attachments'} || {} },
117 $ARGS{'Attach'} => $attachment };
120 if ( $id[0] eq 'new' ) {
122 # {{{ Create a new ticket
124 my $Queue = new RT::Queue( $session{'CurrentUser'} );
125 unless ( $Queue->Load( $ARGS{'Queue'} ) ) {
126 $m->comp( 'Error.html', Why => loc('Queue not found') );
130 unless ( $Queue->CurrentUserHasRight('CreateTicket') ) {
131 $m->comp( 'Error.html',
133 loc('You have no permission to create tickets in that queue.') );
138 ( $Ticket, @results ) =
139 CreateTicket( Attachments => $session{'Attachments'}, %ARGS, Status => 'new' );
141 unless ( $Ticket->id ) {
142 $m->comp( 'Error.html', Why => join( "\n", @results ));
148 # delete temporary storage entry to make WebUI clean
149 unless ( keys %{ $session{'Attachments'} } and $ARGS{'UpdateAttach'} ) {
150 delete $session{'Attachments'};
156 unless ( $Ticket->Load( $id[0] ) ) {
157 $m->comp( 'Error.html',
158 Why => loc( "Couldn't load ticket '[_1]'", $id ) );
165 unless ( $Ticket->CurrentUserHasRight('ShowTicket') ) {
166 $m->comp( 'Error.html',
167 Why => loc("No permission to display that ticket") );
174 if ( ( defined $ARGS{'Status'} )
176 and ( $ARGS{'Status'} ne $Ticket->Status ) )
178 ( $code, $msg ) = $Ticket->SetStatus( $ARGS{'Status'} );
179 push @results, "$msg";
185 $session{'Attachments'}
186 || ( $ARGS{'UpdateContent'} ne ''
187 && $ARGS{'UpdateContent'} ne "-- \n"
188 . $session{'CurrentUser'}->UserObj->Signature )
191 $ARGS{UpdateAttachments} = $session{'Attachments'};
193 ProcessUpdateMessage(
195 Actions => \@results,
199 # delete temporary storage entry to make WebUI clean
200 unless ( keys %{ $session{'Attachments'} } and $ARGS{'UpdateAttach'} ) {
201 delete $session{'Attachments'};
204 my @cfupdates = ProcessObjectCustomFieldUpdates(Object => $Ticket, ARGSRef => \%ARGS);
205 push (@results, @cfupdates);
209 my $Transactions = $Ticket->Transactions;
212 $m->comp( '/Ticket/Elements/FindAttachments', Ticket => $Ticket );