1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
6 %# <sales@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., 51 Franklin Street, Fifth Floor, Boston, MA
26 %# 02110-1301 or visit their web page on the internet at
27 %# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
30 %# CONTRIBUTION SUBMISSION POLICY:
32 %# (The following paragraph is not intended to limit the rights granted
33 %# to you to modify and distribute this software under the terms of
34 %# the GNU General Public License and is only of importance to you if
35 %# you choose to contribute your changes and enhancements to the
36 %# community by submitting them to Best Practical Solutions, LLC.)
38 %# By intentionally submitting any modifications, corrections or
39 %# derivatives to this work, or any other work intended for use with
40 %# Request Tracker, to Best Practical Solutions, LLC, you confirm that
41 %# you are the copyright holder for those contributions and you grant
42 %# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
43 %# royalty-free, perpetual, license to use, copy, create derivative
44 %# works based on those contributions, and sublicense and distribute
45 %# those contributions and any derivatives thereof.
47 %# END BPS TAGGED BLOCK }}}
48 <& /Elements/Header, Title => loc("Ticket #[_1] Jumbo update: [_2]", $Ticket->Id, $Ticket->Subject) &>
51 % $m->callback(CallbackName => 'BeforeActionList', Actions => \@results, ARGSRef => \%ARGS, Ticket => $Ticket);
52 <& /Elements/ListActions, actions => \@results &>
54 <form method="post" action="ModifyAll.html" name="TicketModifyAll" enctype="multipart/form-data">
55 % $m->callback( CallbackName => 'FormStart', ARGSRef => \%ARGS );
56 <input type="hidden" class="hidden" name="id" value="<%$Ticket->Id%>" />
58 <&| /Widgets/TitleBox, title => loc('Modify ticket # [_1]', $Ticket->Id), class=>'ticket-info-basics' &>
59 <& Elements/EditBasics, TicketObj => $Ticket &>
60 <& Elements/EditCustomFields, TicketObj => $Ticket &>
63 % $m->callback(CallbackName => 'AfterBasics', Ticket => $Ticket);
66 <&| /Widgets/TitleBox, title => loc('Dates'), class=>'ticket-info-dates'&>
67 <& Elements/EditDates, TicketObj => $Ticket &>
73 <&| /Widgets/TitleBox, title => loc('People'), class=>'ticket-info-people' &>
74 <& Elements/EditPeople, Ticket => $Ticket, UserField => $UserField, UserString => $UserString, UserOp => $UserOp, GroupString => $GroupString, GroupOp => $GroupOp, GroupField => $GroupField &>
79 <&| /Widgets/TitleBox, title => loc('Links'), class=>'ticket-info-links' &>
80 <& /Elements/EditLinks, Object => $Ticket, Merge => 1 &>
85 <&| /Widgets/TitleBox, title => loc('Update ticket') &>
88 <td class="label"><&|/l&>Update Type</&>:</td>
90 <select name="UpdateType">
92 <option value="private" ><&|/l&>Comments (Not sent to requestors)</&></option>
95 <option value="response"><&|/l&>Reply to requestors</&></option>
98 % $m->callback( %ARGS, CallbackName => 'AfterUpdateType' );
102 <td class="label"><&|/l&>Subject</&>:</td>
103 <td class="entry"><input name="UpdateSubject" size="60" value="<%$Ticket->Subject%>" />
104 % $m->callback( %ARGS, CallbackName => 'AfterSubject' );
108 <tr><td colspan="2"><& /Ticket/Elements/EditTransactionCustomFields, %ARGS, TicketObj => $Ticket &></td></tr>
110 <& /Ticket/Elements/AddAttachments, %ARGS, TicketObj => $Ticket &>
113 <td class="labeltop"><&|/l&>Content</&>:</td>
115 % if (defined $ARGS{UpdateContent} && length($ARGS{UpdateContent} && !grep { /Message recorded/ } @results )) {
116 <& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{UpdateContent}, IncludeSignature => 0 &>
118 <& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &>
126 Name => 'SubmitTicket',
127 Label => loc('Save Changes'),
128 Caption => loc("If you've updated anything above, be sure to"), color => "#333399" &>
135 my $Ticket = LoadTicket($id);
136 my $CustomFields = $Ticket->CustomFields;
138 # call this to show up hints of valid cf values.
140 '/Elements/ValidateCustomFields',
141 CustomFields => $CustomFields,
149 $CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or
150 $Ticket->CurrentUserHasRight('ModifyTicket') );
152 $CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or
153 $Ticket->CurrentUserHasRight('ModifyTicket') );
155 # deal with deleting uploaded attachments
156 foreach my $key (keys %ARGS) {
157 if ($key =~ m/^DeleteAttach-(.+)$/) {
158 delete $session{'Attachments'}{$1};
160 $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
163 # store the uploaded attachment in session
164 if ( defined $ARGS{'Attach'} && length $ARGS{'Attach'} ) { # attachment?
165 my $attachment = MakeMIMEEntity(
166 AttachmentFieldName => 'Attach'
169 my $file_path = Encode::decode_utf8("$ARGS{'Attach'}");
170 $session{'Attachments'} = {
171 %{$session{'Attachments'} || {}},
172 $file_path => $attachment,
176 # delete temporary storage entry to make WebUI clean
177 unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
178 delete $session{'Attachments'};
182 $m->callback( TicketObj => $Ticket, ARGSRef => \%ARGS );
185 unless ($OnlySearchForPeople or $OnlySearchForGroup or $ARGS{'AddMoreAttach'} ) {
186 # There might be two owners.
187 if ( ref ($ARGS{'Owner'} )) {
188 my @owners =@{$ARGS{'Owner'}};
189 delete $ARGS{'Owner'};
190 foreach my $owner(@owners){
191 if (defined($owner) && $owner =~ /\D/) {
192 $ARGS{'Owner'} = $owner unless ($Ticket->OwnerObj->Name eq $owner);
194 elsif (length $owner) {
195 $ARGS{'Owner'} = $owner unless ($Ticket->OwnerObj->id == $owner);
201 push @results, ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
202 push @results, ProcessObjectCustomFieldUpdates( Object => $Ticket, ARGSRef => \%ARGS);
203 push @results, ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
205 # Add session attachments if any to be processed by ProcessUpdateMessage
206 $ARGS{'UpdateAttachments'} = $session{'Attachments'} if ( $session{'Attachments'} );
207 push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS );
209 delete $session{'Attachments'};
211 push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS );
212 push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
214 push @results, ProcessTicketStatus( TicketObj => $Ticket, ARGSRef => \%ARGS );
216 $Ticket->ApplyTransactionBatch;
218 # If they've gone and moved the ticket to somewhere they can't see, etc...
219 # TODO: display the results, even if we can't display the ticket.
221 unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
222 Abort("No permission to view ticket");
231 $OnlySearchForPeople => undef
232 $OnlySearchForGroup => undef
236 $GroupString => undef