rt 4.0.23
[freeside.git] / rt / share / html / Ticket / ModifyAll.html
1 %# BEGIN BPS TAGGED BLOCK {{{
2 %#
3 %# COPYRIGHT:
4 %#
5 %# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
6 %#                                          <sales@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 <& /Elements/Tabs &>
50
51 % $m->callback(CallbackName => 'BeforeActionList', Actions => \@results, ARGSRef => \%ARGS, Ticket => $Ticket);
52 <& /Elements/ListActions, actions => \@results &>
53
54 <form method="post" action="ModifyAll.html" name="TicketModifyAll" enctype="multipart/form-data">
55 % $m->callback( CallbackName => 'FormStart', ARGSRef => \%ARGS );
56 <input type="submit" name="SubmitTicket" value="Save Changes" style="display:none">
57 <input type="hidden" class="hidden" name="id" value="<%$Ticket->Id%>" />
58
59 <&| /Widgets/TitleBox, title => loc('Modify ticket # [_1]', $Ticket->Id), class=>'ticket-info-basics' &>
60 <& Elements/EditBasics, TicketObj => $Ticket &>
61 <& Elements/EditCustomFields, TicketObj => $Ticket &>
62 </&>
63
64 % $m->callback(CallbackName => 'AfterBasics', Ticket => $Ticket);
65 <br />
66
67 <&| /Widgets/TitleBox, title => loc('Dates'), class=>'ticket-info-dates'&>
68 <& Elements/EditDates, TicketObj => $Ticket &>
69 </&>
70
71 <br />
72
73
74 <&| /Widgets/TitleBox, title => loc('People'), class=>'ticket-info-people' &>
75 <& Elements/EditPeople, Ticket => $Ticket, UserField => $UserField, UserString => $UserString, UserOp => $UserOp, GroupString => $GroupString, GroupOp => $GroupOp, GroupField => $GroupField &>
76 </&>
77
78 <br />
79
80 <&| /Widgets/TitleBox, title => loc('Links'), class=>'ticket-info-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 % $m->callback( %ARGS, CallbackName => 'AfterUpdateType' );
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%>" />
105 % $m->callback( %ARGS, CallbackName => 'AfterSubject' );
106     </td>
107   </tr>
108
109   <tr><td colspan="2"><& /Ticket/Elements/EditTransactionCustomFields, %ARGS, TicketObj => $Ticket, KeepValue => 1, &></td></tr>
110
111 <& /Ticket/Elements/AddAttachments, %ARGS, TicketObj => $Ticket &>
112
113   <tr>
114     <td class="labeltop"><&|/l&>Content</&>:</td>
115     <td class="entry">
116 % if ( defined $ARGS{UpdateContent} && length $ARGS{UpdateContent} ) {
117     <& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{UpdateContent}, IncludeSignature => 0 &>
118 % } else {
119     <& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &>
120 % }
121   </td></tr>
122 </table>
123 </&>
124   
125
126 <& /Elements/Submit, 
127     Name    => 'SubmitTicket',
128     Label   => loc('Save Changes'), 
129     Caption => loc("If you've updated anything above, be sure to"), color => "#333399" &>
130 </form>
131
132 <%INIT>
133
134
135
136 my $Ticket = LoadTicket($id);
137 my $CustomFields = $Ticket->CustomFields;
138
139 # call this to show up hints of valid cf values.
140 $m->comp(
141     '/Elements/ValidateCustomFields',
142     CustomFields => $CustomFields,
143     ARGSRef => {},
144 );
145
146 my $CanRespond = 0;
147 my $CanComment = 0;
148
149
150 $CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or
151                      $Ticket->CurrentUserHasRight('ModifyTicket') ); 
152
153 $CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or
154                      $Ticket->CurrentUserHasRight('ModifyTicket') );
155
156 ProcessAttachments(ARGSRef => \%ARGS);
157
158 $m->callback( TicketObj => $Ticket, ARGSRef => \%ARGS );
159 my @results;
160
161 unless ($OnlySearchForPeople or $OnlySearchForGroup or $ARGS{'AddMoreAttach'} ) {
162     # There might be two owners. 
163     if ( ref ($ARGS{'Owner'} )) {
164         my @owners =@{$ARGS{'Owner'}};
165         delete $ARGS{'Owner'};
166         foreach my $owner(@owners){
167             if (defined($owner) && $owner =~ /\D/) {
168                 $ARGS{'Owner'} = $owner unless ($Ticket->OwnerObj->Name eq $owner);
169             }
170             elsif (length $owner) {
171                 $ARGS{'Owner'} = $owner unless ($Ticket->OwnerObj->id == $owner);
172             }
173         }
174
175     }
176
177     push @results, ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
178     push @results, ProcessObjectCustomFieldUpdates( Object => $Ticket, ARGSRef => \%ARGS);
179     push @results, ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
180     
181     # Add session attachments if any to be processed by ProcessUpdateMessage
182     $ARGS{'UpdateAttachments'} = $session{'Attachments'} if ( $session{'Attachments'} );
183     push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS );
184     # Cleanup WebUI
185     delete $session{'Attachments'};
186
187     push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS );
188     push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
189 }
190     push @results, ProcessTicketStatus( TicketObj => $Ticket, ARGSRef => \%ARGS );
191
192 $Ticket->ApplyTransactionBatch;
193
194 MaybeRedirectForResults(
195     Actions   => \@results,
196     Path      => "/Ticket/ModifyAll.html",
197     Arguments => { id => $Ticket->id },
198 );
199
200 # If they've gone and moved the ticket to somewhere they can't see, etc...
201 unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
202     if (@results) {
203         Abort("A change was applied successfully, but you no longer have permissions to view the ticket", Actions => \@results);
204     } else {
205         Abort("No permission to view ticket");
206     }
207 }
208
209
210 </%INIT>
211
212
213
214 <%ARGS>
215 $OnlySearchForPeople => undef
216 $OnlySearchForGroup => undef
217 $UserField => undef
218 $UserOp => undef
219 $UserString => undef
220 $GroupString => undef
221 $GroupOp => undef
222 $GroupField => undef
223 $id => undef
224 </%ARGS>
225