This commit was generated by cvs2svn to compensate for changes in r8690,
[freeside.git] / rt / share / html / Ticket / ModifyAll.html
1 %# BEGIN BPS TAGGED BLOCK {{{
2 %# 
3 %# COPYRIGHT:
4 %# 
5 %# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
6 %#                                          <jesse@bestpractical.com>
7 %# 
8 %# (Except where explicitly superseded by other copyright notices)
9 %# 
10 %# 
11 %# LICENSE:
12 %# 
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
16 %# from www.gnu.org.
17 %# 
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.
22 %# 
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.
28 %# 
29 %# 
30 %# CONTRIBUTION SUBMISSION POLICY:
31 %# 
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.)
37 %# 
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.
46 %# 
47 %# END BPS TAGGED BLOCK }}}
48 <& /Elements/Header, Title => loc("Ticket #[_1] Jumbo update: [_2]", $Ticket->Id, $Ticket->Subject) &>
49 <& /Ticket/Elements/Tabs, 
50     Ticket => $Ticket, 
51     current_tab => "Ticket/ModifyAll.html?id=".$Ticket->Id, 
52     Title => loc("Ticket #[_1] Jumbo update: [_2]", $Ticket->Id, $Ticket->Subject) &>
53
54 % $m->callback(CallbackName => 'BeforeActionList', Actions => \@results, ARGSRef => \%ARGS, Ticket => $Ticket);
55 <& /Elements/ListActions, actions => \@results &>
56
57 <form method="post" action="ModifyAll.html" enctype="multipart/form-data">
58 % $m->callback( CallbackName => 'FormStart', ARGSRef => \%ARGS );
59 <input type="hidden" class="hidden" name="id" value="<%$Ticket->Id%>" />
60
61 <&| /Widgets/TitleBox, title => loc('Modify ticket # [_1]', $Ticket->Id), class=>'ticket-info-basics' &>
62 <& Elements/EditBasics, TicketObj => $Ticket &>
63 <& Elements/EditCustomFields, TicketObj => $Ticket &>
64 </&>
65
66 <br />
67
68 <&| /Widgets/TitleBox, title => loc('Dates'), class=>'ticket-info-dates'&>
69 <& Elements/EditDates, TicketObj => $Ticket &>
70 </&>
71
72 <br />
73
74
75 <&| /Widgets/TitleBox, title => loc('People'), class=>'ticket-info-people' &>
76 <& Elements/EditPeople, Ticket => $Ticket, UserField => $UserField, UserString => $UserString, UserOp => $UserOp, GroupString => $GroupString, GroupOp => $GroupOp, GroupField => $GroupField &>
77 </&>
78
79 <br />
80
81 <&| /Widgets/TitleBox, title => loc('Links'), class=>'ticket-info-links' &>
82 <& /Elements/EditLinks, Object => $Ticket, Merge => 1 &>
83 </&>
84
85 <br />
86
87 <&| /Widgets/TitleBox, title => loc('Update ticket') &>
88 <table>
89   <tr>
90     <td class="label"><&|/l&>Update Type</&>:</td>
91     <td class="entry">
92       <select name="UpdateType">
93 % if ($CanComment) {
94         <option value="private" ><&|/l&>Comments (Not sent to requestors)</&></option>
95 % }
96 % if ($CanRespond) {
97         <option value="response"><&|/l&>Reply to requestors</&></option>
98 % }
99       </select> 
100     </td>
101   </tr>
102   <tr>
103     <td class="label"><&|/l&>Subject</&>:</td>
104     <td class="entry"><input name="UpdateSubject" size="60" value="<%$Ticket->Subject%>" /></td>
105   </tr>
106 % if (my $TxnCFs = $Ticket->TransactionCustomFields) {
107 %    while (my $CF = $TxnCFs->Next()) {
108 <tr>
109 <td class="label"><% loc($CF->Name) %>:</td>
110 <td class="entry"><& /Elements/EditCustomField, 
111     CustomField => $CF, 
112     NamePrefix => "Object-RT::Transaction--CustomField-"
113     &><em><% $CF->FriendlyType %></em>
114 </td></tr>
115 %    } # end if while
116 % } # end of if
117 % if (exists $session{'Attachments'}) {
118 <tr><td><&|/l&>Attached file</&>:</td>
119 <td>
120 <&|/l&>Check box to delete</&><br />
121 % foreach my $attach_name (keys %{$session{'Attachments'}}) {
122 <input type="checkbox" class="checkbox" name="DeleteAttach-<%$attach_name%>" value="1" /><%$attach_name%><br />
123 % } # end of foreach
124 </td>
125 </tr>
126 % } # end of if
127
128   <tr>
129     <td class="label"><&|/l&>Attach</&>:</td>
130     <td class="entry"><input name="Attach" type="file" />
131     <input type="submit" class="button" name="AddMoreAttach" value="<&|/l&>Add More Files</&>" />
132     <input type="hidden" class="hidden" name="UpdateAttach" value="1" /></td>
133   </tr>
134   <tr>
135     <td class="labeltop"><&|/l&>Content</&>:</td>
136     <td class="entry"><& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &></td>
137   </tr>
138 </table>
139 </&>
140   
141
142 <& /Elements/Submit, 
143     Name    => 'SubmitTicket',
144     Label   => loc('Save Changes'), 
145     Caption => loc("If you've updated anything above, be sure to"), color => "#333399" &>
146 </form>
147
148 <%INIT>
149
150
151
152 my $Ticket = LoadTicket($id);
153 my $CustomFields = $Ticket->CustomFields;
154
155 # call this to show up hints of valid cf values.
156 $m->comp(
157     '/Elements/ValidateCustomFields',
158     CustomFields => $CustomFields,
159     ARGSRef => {},
160 );
161
162 my $CanRespond = 0;
163 my $CanComment = 0;
164
165
166 $CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or
167                      $Ticket->CurrentUserHasRight('ModifyTicket') ); 
168
169 $CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or
170                      $Ticket->CurrentUserHasRight('ModifyTicket') );
171
172 # {{{ deal with deleting uploaded attachments
173 foreach my $key (keys %ARGS) {
174     if ($key =~ m/^DeleteAttach-(.+)$/) {
175         delete $session{'Attachments'}{$1};
176     }
177     $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
178 }
179 # }}}
180
181 # {{{ store the uploaded attachment in session
182 if ($ARGS{'Attach'}) {            # attachment?
183     my $attachment = MakeMIMEEntity(
184         AttachmentFieldName => 'Attach'
185     );
186
187     my $file_path = Encode::decode_utf8("$ARGS{'Attach'}");
188     $session{'Attachments'} = {
189         %{$session{'Attachments'} || {}},
190         $file_path => $attachment,
191     };
192 }
193 # }}}
194
195 # delete temporary storage entry to make WebUI clean
196 unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
197     delete $session{'Attachments'};
198 }
199 # }}}
200
201
202 $m->callback( TicketObj => $Ticket, ARGSRef => \%ARGS );
203 my @results;
204
205 unless ($OnlySearchForPeople or $OnlySearchForGroup or $ARGS{'AddMoreAttach'} ) {
206     # There might be two owners. 
207     if ( ref ($ARGS{'Owner'} )) {
208         my @owners =@{$ARGS{'Owner'}};
209         delete $ARGS{'Owner'};
210         foreach my $owner(@owners){
211             $ARGS{'Owner'} = $owner unless ($Ticket->OwnerObj->id == $owner);
212         }
213
214     }
215
216     push @results, ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
217     push @results, ProcessObjectCustomFieldUpdates( Object => $Ticket, ARGSRef => \%ARGS);
218     push @results, ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
219     
220     # Add session attachments if any to be processed by ProcessUpdateMessage
221     $ARGS{'UpdateAttachments'} = $session{'Attachments'} if ( $session{'Attachments'} );
222     push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS );
223     # Cleanup WebUI
224     delete $session{'Attachments'};
225
226     push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS );
227     push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
228 }
229
230 $Ticket->ApplyTransactionBatch;
231
232 # If they've gone and moved the ticket to somewhere they can't see, etc...
233 # TODO: display the results, even if we can't display the ticket.
234
235 unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
236    Abort("No permission to view ticket");
237 }
238
239
240 </%INIT>
241
242
243
244 <%ARGS>
245 $OnlySearchForPeople => undef
246 $OnlySearchForGroup => undef
247 $UserField => undef
248 $UserOp => undef
249 $UserString => undef
250 $GroupString => undef
251 $GroupOp => undef
252 $GroupField => undef
253 $id => undef
254 </%ARGS>
255