import rt 3.4.6
[freeside.git] / rt / html / Ticket / ModifyAll.html
1 %# BEGIN BPS TAGGED BLOCK {{{
2 %# 
3 %# COPYRIGHT:
4 %#  
5 %# This software is Copyright (c) 1996-2005 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., 675 Mass Ave, Cambridge, MA 02139, USA.
26 %# 
27 %# 
28 %# CONTRIBUTION SUBMISSION POLICY:
29 %# 
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.)
35 %# 
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.
44 %# 
45 %# END BPS TAGGED BLOCK }}}
46 <& /Elements/Header, Title => loc("Ticket #[_1] Jumbo update: [_2]", $Ticket->Id, $Ticket->Subject) &>
47 <& /Ticket/Elements/Tabs, 
48     Ticket => $Ticket, 
49     current_tab => "Ticket/ModifyAll.html?id=".$Ticket->Id, 
50     Title => loc("Ticket #[_1] Jumbo update: [_2]", $Ticket->Id, $Ticket->Subject) &>
51
52 <& /Elements/ListActions, actions => \@results &>
53
54 <FORM METHOD=POST ACTION="ModifyAll.html" ENCTYPE="multipart/form-data">
55 <INPUT TYPE=HIDDEN NAME=id VALUE="<%$Ticket->Id%>">
56
57
58 <& /Elements/TitleBoxStart, title => loc('Modify ticket # [_1]', $Ticket->Id),   color=> "#993333", width => "100%" &>
59 <& Elements/EditBasics, TicketObj => $Ticket &>
60 <& Elements/EditCustomFields, TicketObj => $Ticket &>
61 <& /Elements/TitleBoxEnd &>
62
63 <BR>
64
65 <& /Elements/TitleBoxStart, title => loc('Dates'),  width => "100%", color => "#663366"  &>
66 <& Elements/EditDates, TicketObj => $Ticket &>
67 <& /Elements/TitleBoxEnd &>
68
69 <BR>
70
71
72 <& /Elements/TitleBoxStart, title => loc('People'),width => "100%", color=> "#333399" &>
73 <& Elements/EditPeople, Ticket => $Ticket, UserField => $UserField, UserString => $UserString, UserOp => $UserOp &>
74 <& /Elements/TitleBoxEnd &>
75
76 <BR>
77
78 <& /Elements/TitleBoxStart, title => loc('Links'), color => "#336633"&>
79 <& /Elements/EditLinks, Object => $Ticket, Merge => 1 &>
80 <& /Elements/TitleBoxEnd &>
81
82 <BR>
83
84 <& /Elements/TitleBoxStart, title => loc('Update ticket') &>
85 <table>
86   <tr>
87     <td class="label"><&|/l&>Update Type</&>:</td>
88     <td class="entry">
89       <select name="UpdateType">
90 % if ($CanComment) {
91         <option value="private" ><&|/l&>Comments (Not sent to requestors)</&></option>
92 % }
93 % if ($CanRespond) {
94         <option value="response"><&|/l&>Reply to requestors</&></option>
95 % }
96       </select> 
97     </td>
98   </tr>
99   <tr>
100     <td class="label"><&|/l&>Subject</&>:</td>
101     <td class="entry"><input name="UpdateSubject" size=60 value="<%$Ticket->Subject%>"></td>
102   </tr>
103 % if (my $TxnCFs = $Ticket->TransactionCustomFields) {
104 %    while (my $CF = $TxnCFs->Next()) {
105 <TR>
106 <TD class="label"><% $CF->Name %>:</TD>
107 <TD class="entry"><& /Elements/EditCustomField, 
108     CustomField => $CF, 
109     NamePrefix => "Object-RT::Transaction--CustomField-"
110     &><em><% $CF->FriendlyType %></em></TD>
111 </TD></TR>
112 %    } # end if while
113 % } # end of if
114   <tr>
115     <td class="label"><&|/l&>Attach</&>:</td>
116     <td class="entry"><input name="UpdateAttachment" type=file></td>
117   </tr>
118   <tr>
119     <td class="labeltop"><&|/l&>Content</&>:</td>
120     <td class="entry"><& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &></td>
121   </tr>
122 </table>
123 <& /Elements/TitleBoxEnd &>
124   
125
126 <& /Elements/Submit, 
127     Label => loc('Save Changes'), 
128     Caption => loc("If you've updated anything above, be sure to"), color => "#333399" &>
129 </form>
130
131 <%INIT>
132
133
134
135 my $Ticket = LoadTicket($id);
136
137 my $CanRespond = 0;
138 my $CanComment = 0;
139
140
141 $CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or
142                      $Ticket->CurrentUserHasRight('ModifyTicket') ); 
143
144 $CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or
145                      $Ticket->CurrentUserHasRight('ModifyTicket') );
146
147
148 my (@wresults, @results,  @dresults, @lresults, @cf_results);
149
150 unless ($OnlySearchForPeople) {
151     @wresults = ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
152  @cf_results = ProcessObjectCustomFieldUpdates( Object => $Ticket, ARGSRef => \%ARGS);
153     @dresults = ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
154     @lresults = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
155
156     if ($ARGS{'UpdateAttachment'}) {
157         my $subject = "$ARGS{'UpdateAttachment'}";
158         # since CGI.pm deutf8izes the magic field, we need to add it back.
159         Encode::_utf8_on($subject);
160         # strip leading directories
161         $subject =~ s#^.*[\\/]##;
162
163         my $attachment = MakeMIMEEntity(
164            Subject             => $subject,
165            Body                => "",
166            AttachmentFieldName => 'UpdateAttachment'
167         );
168         delete $ARGS{'UpdateAttachment'};
169         $ARGS{'UpdateAttachments'}->{ $subject } = $attachment;
170     }
171
172     $ARGS{'UpdateContent'} =~ s/\r+\n/\n/g;
173
174     if ($ARGS{'UpdateAttachments'} || ( $ARGS{'UpdateContent'} && $ARGS{'UpdateContent'} ne  "-- \n" . 
175                                 $session{'CurrentUser'}->UserObj->Signature)) {
176          ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef=>\%ARGS, Actions=>\@results);
177         }
178     @results = ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS);
179 }
180 push @results, @wresults;
181 push @results, @dresults;
182 push @results, @lresults;
183 push @results, @cf_results;
184
185 # If they've gone and moved the ticket to somewhere they can't see, etc...
186 # TODO: display the results, even if we can't display the ticket.
187
188 unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
189    Abort("No permission to view ticket");
190 }
191
192
193 </%INIT>
194
195
196
197 <%ARGS>
198 $OnlySearchForPeople => undef
199 $UserField => undef
200 $UserOp => undef
201 $UserString => undef
202 $id => undef
203 </%ARGS>
204