import rt 3.0.12
[freeside.git] / rt / html / Ticket / ModifyAll.html
1 %# BEGIN LICENSE BLOCK
2 %# 
3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
4 %# 
5 %# (Except where explictly superceded by other copyright notices)
6 %# 
7 %# This work is made available to you under the terms of Version 2 of
8 %# the GNU General Public License. A copy of that license should have
9 %# been provided with this software, but in any event can be snarfed
10 %# from www.gnu.org.
11 %# 
12 %# This work is distributed in the hope that it will be useful, but
13 %# WITHOUT ANY WARRANTY; without even the implied warranty of
14 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 %# General Public License for more details.
16 %# 
17 %# Unless otherwise specified, all modifications, corrections or
18 %# extensions to this work which alter its source code become the
19 %# property of Best Practical Solutions, LLC when submitted for
20 %# inclusion in the work.
21 %# 
22 %# 
23 %# END LICENSE BLOCK
24 <& /Elements/Header, Title => loc("Ticket #[_1] Jumbo update: [_2]", $Ticket->Id, $Ticket->Subject) &>
25 <& /Ticket/Elements/Tabs, 
26     Ticket => $Ticket, 
27     current_tab => "Ticket/ModifyAll.html?id=".$Ticket->Id, 
28     Title => loc("Ticket #[_1] Jumbo update: [_2]", $Ticket->Id, $Ticket->Subject) &>
29
30 <& /Elements/ListActions, actions => \@results &>
31
32 <FORM METHOD=POST ACTION="ModifyAll.html" ENCTYPE="multipart/form-data">
33 <INPUT TYPE=HIDDEN NAME=id VALUE="<%$Ticket->Id%>">
34
35
36 <& /Elements/TitleBoxStart, title => loc('Modify ticket # [_1]', $Ticket->Id),   color=> "#993333", width => "100%" &>
37 <& Elements/EditBasics, TicketObj => $Ticket &>
38 <& Elements/EditCustomFields, TicketObj => $Ticket &>
39 <& /Elements/TitleBoxEnd &>
40
41 <BR>
42
43 <& /Elements/TitleBoxStart, title => loc('Dates'),  width => "100%", color => "#663366"  &>
44 <& Elements/EditDates, TicketObj => $Ticket &>
45 <& /Elements/TitleBoxEnd &>
46
47 <BR>
48
49
50 <& /Elements/TitleBoxStart, title => loc('People'),width => "100%", color=> "#333399" &>
51 <& Elements/EditPeople, Ticket => $Ticket, UserField => $UserField, UserString => $UserString, UserOp => $UserOp &>
52 <& /Elements/TitleBoxEnd &>
53
54 <BR>
55
56 <& /Elements/TitleBoxStart, title => loc('Relationships'), color => "#336633"&>
57 <& Elements/EditLinks, Ticket => $Ticket &>
58 <& /Elements/TitleBoxEnd &>
59
60 <BR>
61
62 <& /Elements/TitleBoxStart, title => loc('Update ticket') &>
63 <table>
64   <tr>
65     <td class="label"><&|/l&>Update Type</&>:</td>
66     <td class="entry">
67       <select name="UpdateType">
68 % if ($CanComment) {
69         <option value="private" ><&|/l&>Comments (Not sent to requestors)</&></option>
70 % }
71 % if ($CanRespond) {
72         <option value="response"><&|/l&>Response to requestors</&></option>
73 % }
74       </select> 
75     </td>
76   </tr>
77   <tr>
78     <td class="label"><&|/l&>Subject</&>:</td>
79     <td class="entry"><input name="UpdateSubject" size=60 value="<%$Ticket->Subject%>"></td>
80   </tr>
81   <tr>
82     <td class="label"><&|/l&>Attach</&>:</td>
83     <td class="entry"><input name="UpdateAttachment" type=file></td>
84   </tr>
85   <tr>
86     <td class="labeltop"><&|/l&>Content</&>:</td>
87     <td class="entry"><& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &></td>
88   </tr>
89 </table>
90 <& /Elements/TitleBoxEnd &>
91   
92
93 <& /Elements/Submit, Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), color => "#333399" &>
94 </form>
95
96 <%INIT>
97
98
99
100 my $Ticket = LoadTicket($id);
101
102 my $CanRespond = 0;
103 my $CanComment = 0;
104
105
106 $CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or
107                      $Ticket->CurrentUserHasRight('ModifyTicket') ); 
108
109 $CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or
110                      $Ticket->CurrentUserHasRight('ModifyTicket') );
111
112
113 my (@wresults, @results,  @dresults, @lresults, @cf_results);
114
115 unless ($OnlySearchForPeople) {
116     @wresults = ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
117     @results = ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS);
118  @cf_results = ProcessTicketCustomFieldUpdates( TicketObj => $Ticket, ARGSRef => \%ARGS);
119     @dresults = ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
120     @lresults = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
121
122     if ($ARGS{'UpdateAttachment'}) {
123         my $subject = "$ARGS{'UpdateAttachment'}";
124         # since CGI.pm deutf8izes the magic field, we need to add it back.
125         Encode::_utf8_on($subject);
126         # strip leading directories
127         $subject =~ s#^.*[\\/]##;
128
129         my $attachment = MakeMIMEEntity(
130            Subject             => $subject,
131            Body                => "",
132            AttachmentFieldName => 'UpdateAttachment'
133         );
134         delete $ARGS{'UpdateAttachment'};
135         $ARGS{'UpdateAttachments'}->{ $subject } = $attachment;
136     }
137
138     $ARGS{'UpdateContent'} =~ s/\r+\n/\n/g;
139
140     if ($ARGS{'UpdateAttachments'} || (
141         $ARGS{'UpdateContent'} &&
142         $ARGS{'UpdateContent'} ne  "-- \n" . 
143                                 $session{'CurrentUser'}->UserObj->Signature
144        )) {
145          ProcessUpdateMessage(TicketObj => $Ticket, 
146                               ARGSRef=>\%ARGS, 
147                               Actions=>\@results);
148         }
149 }
150 push @results, @wresults;
151 push @results, @dresults;
152 push @results, @lresults;
153 push @results, @cf_results;
154
155 # If they've gone and moved the ticket to somewhere they can't see, etc...
156 # TODO: display the results, even if we can't display the ticket.
157
158 unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
159    Abort("No permission to view ticket");
160 }
161
162
163 </%INIT>
164
165
166
167 <%ARGS>
168 $OnlySearchForPeople => undef
169 $UserField => undef
170 $UserOp => undef
171 $UserString => undef
172 $id => undef
173 </%ARGS>
174