import rt 3.6.4
[freeside.git] / rt / html / Ticket / ModifyAll.html
1 %# BEGIN BPS TAGGED BLOCK {{{
2 %# 
3 %# COPYRIGHT:
4 %#  
5 %# This software is Copyright (c) 1996-2007 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/copyleft/gpl.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 <& /Elements/ListActions, actions => \@results &>
55
56 <form method="post" action="ModifyAll.html" enctype="multipart/form-data">
57 <& /Elements/Callback, _CallbackName => 'FormStart',ARGSRef =>\%ARGS &>
58 <input type="hidden" class="hidden" name="id" value="<%$Ticket->Id%>" />
59
60 <&| /Widgets/TitleBox, title => loc('Modify ticket # [_1]', $Ticket->Id) &>
61 <& Elements/EditBasics, TicketObj => $Ticket &>
62 <& Elements/EditCustomFields, TicketObj => $Ticket &>
63 </&>
64
65 <br />
66
67 <&| /Widgets/TitleBox, title => loc('Dates') &>
68 <& Elements/EditDates, TicketObj => $Ticket &>
69 </&>
70
71 <br />
72
73
74 <&| /Widgets/TitleBox, title => loc('People') &>
75 <& Elements/EditPeople, Ticket => $Ticket, UserField => $UserField, UserString => $UserString, UserOp => $UserOp &>
76 </&>
77
78 <br />
79
80 <&| /Widgets/TitleBox, title => loc('Links') &>
81 <& /Elements/EditLinks, Object => $Ticket, Merge => 1 &>
82 </&>
83
84 <br />
85
86 <&| /Widgets/TitleBox, title => loc('Update ticket') &>
87 <table>
88   <tr>
89     <td class="label"><&|/l&>Update Type</&>:</td>
90     <td class="entry">
91       <select name="UpdateType">
92 % if ($CanComment) {
93         <option value="private" ><&|/l&>Comments (Not sent to requestors)</&></option>
94 % }
95 % if ($CanRespond) {
96         <option value="response"><&|/l&>Reply to requestors</&></option>
97 % }
98       </select> 
99     </td>
100   </tr>
101   <tr>
102     <td class="label"><&|/l&>Subject</&>:</td>
103     <td class="entry"><input name="UpdateSubject" size="60" value="<%$Ticket->Subject%>" /></td>
104   </tr>
105 % if (my $TxnCFs = $Ticket->TransactionCustomFields) {
106 %    while (my $CF = $TxnCFs->Next()) {
107 <tr>
108 <td class="label"><% $CF->Name %>:</td>
109 <td class="entry"><& /Elements/EditCustomField, 
110     CustomField => $CF, 
111     NamePrefix => "Object-RT::Transaction--CustomField-"
112     &><em><% $CF->FriendlyType %></em></td>
113 </td></tr>
114 %    } # end if while
115 % } # end of if
116   <tr>
117     <td class="label"><&|/l&>Attach</&>:</td>
118     <td class="entry"><input name="UpdateAttachment" type="file" /></td>
119   </tr>
120   <tr>
121     <td class="labeltop"><&|/l&>Content</&>:</td>
122     <td class="entry"><& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &></td>
123   </tr>
124 </table>
125 </&>
126   
127
128 <& /Elements/Submit, 
129     Label => loc('Save Changes'), 
130     Caption => loc("If you've updated anything above, be sure to"), color => "#333399" &>
131 </form>
132
133 <%INIT>
134
135
136
137 my $Ticket = LoadTicket($id);
138
139 my $CanRespond = 0;
140 my $CanComment = 0;
141
142
143 $CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or
144                      $Ticket->CurrentUserHasRight('ModifyTicket') ); 
145
146 $CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or
147                      $Ticket->CurrentUserHasRight('ModifyTicket') );
148
149
150 $m->comp('/Elements/Callback', TicketObj => $Ticket, ARGSRef => \%ARGS);
151 my (@wresults, @results,  @dresults, @lresults, @cf_results);
152
153 unless ($OnlySearchForPeople) {
154     # There might be two owners. 
155     if ( ref ($ARGS{'Owner'} )) {
156         my @owners =@{$ARGS{'Owner'}};
157         delete $ARGS{'Owner'};
158         foreach my $owner(@owners){
159             $ARGS{'Owner'} = $owner unless ($Ticket->OwnerObj->id == $owner);
160         }
161
162     }
163
164     @wresults = ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
165  @cf_results = ProcessObjectCustomFieldUpdates( Object => $Ticket, ARGSRef => \%ARGS);
166     @dresults = ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
167     @lresults = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
168
169     if ($ARGS{'UpdateAttachment'}) {
170         my $subject = "$ARGS{'UpdateAttachment'}";
171         # since CGI.pm deutf8izes the magic field, we need to add it back.
172         Encode::_utf8_on($subject);
173         # strip leading directories
174         $subject =~ s#^.*[\\/]##;
175
176         my $attachment = MakeMIMEEntity(
177            Subject             => $subject,
178            Body                => "",
179            AttachmentFieldName => 'UpdateAttachment'
180         );
181         delete $ARGS{'UpdateAttachment'};
182         $ARGS{'UpdateAttachments'}->{ $subject } = $attachment;
183     }
184
185     $ARGS{'UpdateContent'} =~ s/\r+\n/\n/g if $ARGS{'UpdateContent'};
186
187     if ($ARGS{'UpdateAttachments'} || ( $ARGS{'UpdateContent'} && $ARGS{'UpdateContent'} ne  "-- \n" . 
188                                 $session{'CurrentUser'}->UserObj->Signature)) {
189          ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef=>\%ARGS, Actions=>\@results);
190         }
191     @results = ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS);
192 }
193 push @results, @wresults;
194 push @results, @dresults;
195 push @results, @lresults;
196 push @results, @cf_results;
197
198 # undef so that TransactionBatch scrips run and update the ticket
199 $Ticket = undef;
200 $Ticket = LoadTicket($id);
201
202 # If they've gone and moved the ticket to somewhere they can't see, etc...
203 # TODO: display the results, even if we can't display the ticket.
204
205 unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
206    Abort("No permission to view ticket");
207 }
208
209
210 </%INIT>
211
212
213
214 <%ARGS>
215 $OnlySearchForPeople => undef
216 $UserField => undef
217 $UserOp => undef
218 $UserString => undef
219 $id => undef
220 </%ARGS>
221