1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
6 %# <sales@bestpractical.com>
8 %# (Except where explicitly superseded by other copyright notices)
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
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.
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.
30 %# CONTRIBUTION SUBMISSION POLICY:
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.)
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.
47 %# END BPS TAGGED BLOCK }}}
48 <& /Elements/Header, Title => $title &>
51 % $m->callback(CallbackName => 'BeforeActionList', ARGSRef => \%ARGS, Ticket => $TicketObj);
52 <& /Elements/ListActions, actions => \@results &>
54 <form action="Update.html" name="TicketUpdate"
55 method="post" enctype="multipart/form-data">
56 % $m->callback( CallbackName => 'FormStart', ARGSRef => \%ARGS, Ticket => $TicketObj, CanRespond => $CanRespond, CanComment => $CanComment, ResponseDefault => $ResponseDefault, CommentDefault => $CommentDefault );
57 <input type="hidden" class="hidden" name="QuoteTransaction" value="<% $ARGS{QuoteTransaction}||'' %>" />
58 <input type="hidden" class="hidden" name="DefaultStatus" value="<% $DefaultStatus ||''%>" />
59 <input type="hidden" class="hidden" name="Action" value="<% $Action %>" />
60 <input type="hidden" class="hidden" name="Token" value="<% $ARGS{'Token'} %>" />
62 <& /Elements/Crypt/SignEncryptWidget:ShowIssues, self => $gnupg_widget &>
64 <div id="ticket-update-metadata">
65 <&|/Widgets/TitleBox, title => loc('Ticket and Transaction') &>
66 <table width="100%" border="0">
67 % $m->callback(CallbackName => 'AfterTableOpens', ARGSRef => \%ARGS, Ticket => $TicketObj);
70 % $m->callback( %ARGS, CallbackName => 'BeforeUpdateType', skip => \$skip );
72 <input type="hidden" class="hidden" name="id" value="<%$TicketObj->Id%>" /><br />
74 <tr><td class="label"><&|/l&>Update Type</&>:</td>
75 <td><select name="UpdateType" id="UpdateType">
77 <option value="private" <% ($ARGS{'UpdateType'} && $ARGS{'UpdateType'} eq "private") ? qq[ selected="selected"] : !$ARGS{'UpdateType'}&&$CommentDefault |n %>><&|/l&>Comments (Not sent to requestors)</&></option>
80 <option value="response" <% ($ARGS{'UpdateType'} && $ARGS{'UpdateType'} eq "response") ? qq[ selected="selected"] : !$ARGS{'UpdateType'}&&$ResponseDefault |n %>><&|/l&>Reply to requestors</&></option>
84 <script type="text/javascript">
86 jQuery("#UpdateType").change(function(ev) {
87 jQuery(".messagebox-container")
88 .removeClass("action-response action-private")
89 .addClass("action-"+ev.target.value);
93 jQuery("input[name=TxnSendMailTo]").change(function(ev) {
94 jQuery("input[name=TxnSendMailTo][value="+ev.target.value+"]")
95 .attr("checked",jQuery(ev.target).attr('checked'));
100 % $m->callback( %ARGS, CallbackName => 'AfterUpdateType' );
103 <& /Ticket/Elements/EditBasics,
104 TicketObj => $TicketObj,
108 comp => '/Ticket/Elements/SelectStatus',
111 Default => $DefaultStatus,
112 TicketObj => $TicketObj,
116 comp => '/Elements/SelectOwner',
119 TicketObj => $TicketObj,
120 QueueObj => $TicketObj->QueueObj,
121 DefaultLabel => loc("[_1] (Unchanged)", $TicketObj->OwnerObj->Format),
122 Default => $ARGS{'Owner'}
126 comp => '/Elements/EditTimeValue',
128 Name => 'UpdateTimeWorked',
129 Default => $ARGS{UpdateTimeWorked}||'',
130 InUnits => $ARGS{'UpdateTimeWorked-TimeUnits'}||'minutes',
136 % $m->callback( %ARGS, CallbackName => 'AfterWorked', Ticket => $TicketObj );
138 <& /Ticket/Elements/EditTransactionCustomFields, %ARGS, TicketObj => $TicketObj, InTable => 1 &>
144 <div id="ticket-update-message">
145 <& /Ticket/Elements/ShowSimplifiedRecipients, TicketObj => $TicketObj, %ARGS &>
147 <&|/Widgets/TitleBox, title => loc('Message'), class => 'messagedetails' &>
148 <table width="100%" border="0">
149 <& /Ticket/Elements/UpdateCc, %ARGS, TicketObj => $TicketObj &>
151 % if ( $gnupg_widget ) {
152 <tr><td> </td><td>
153 <& /Elements/Crypt/SignEncryptWidget,
154 self => $gnupg_widget,
155 TicketObj => $TicketObj,
159 % $m->callback( %ARGS, CallbackName => 'AfterGnuPG' );
161 <tr><td class="label"><&|/l&>Subject</&>:</td><td> <input type="text" name="UpdateSubject" value="<% $ARGS{UpdateSubject} || $TicketObj->Subject || '' %>" />
162 % $m->callback( %ARGS, CallbackName => 'AfterSubject' );
165 <tr><td class="label" valign="top"><&|/l&>Message</&>:</td>
166 <td class="messagebox-container action-<% $type %>">
167 <& /Articles/Elements/BeforeMessageBox, %ARGS &>
168 % $m->callback( %ARGS, CallbackName => 'BeforeMessageBox' );
169 % if (exists $ARGS{UpdateContent}) {
170 % # preserve QuoteTransaction so we can use it to set up sane references/in/reply to
171 % my $temp = $ARGS{'QuoteTransaction'};
172 % delete $ARGS{'QuoteTransaction'};
173 <& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{UpdateContent}, IncludeSignature => 0, %ARGS&>
174 % $ARGS{'QuoteTransaction'} = $temp;
176 % my $IncludeSignature = 1;
177 % $IncludeSignature = 0 if $Action ne 'Respond' && !RT->Config->Get('MessageBoxIncludeSignatureOnComment');
178 <& /Elements/MessageBox, Name=>"UpdateContent", IncludeSignature => $IncludeSignature, %ARGS &>
180 % $m->callback( %ARGS, CallbackName => 'AfterMessageBox' );
183 <& /Ticket/Elements/AddAttachments, %ARGS, TicketObj => $TicketObj &>
187 % $m->callback( %ARGS, CallbackName => 'BeforeSubmit', Ticket => $TicketObj );
189 <& /Elements/Submit, Label => loc('Update Ticket'), Name => 'SubmitTicket', id => 'SubmitTicket' &>
191 % $m->callback( %ARGS, CallbackName => 'BeforeScrips', Ticket => $TicketObj );
193 % if ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail')) {
194 <&|/Widgets/TitleBox, title => loc('Scrips and Recipients'), id => 'previewscrips', rolledup => RT->Config->Get('SimplifiedRecipients', $session{'CurrentUser'}) &>
195 <& /Ticket/Elements/PreviewScrips, TicketObj => $TicketObj, %ARGS &>
200 % $m->callback( %ARGS, CallbackName => 'AfterScrips', Ticket => $TicketObj );
202 % if (my $recips = $m->notes("DryRun-Recipients-".$TicketObj->Id)) {
203 <input type="hidden" name="TxnRecipients" value="<% join ",",sort keys %{$recips} %>" />
209 % $m->callback( %ARGS, CallbackName => 'AfterForm', Ticket => $TicketObj );
214 my $checks_failure = 0;
216 my $TicketObj = LoadTicket($id);
220 $m->callback( Ticket => $TicketObj, ARGSRef => \%ARGS, checks_failure => \$checks_failure, results => \@results, CallbackName => 'Initial' );
221 $m->scomp( '/Articles/Elements/SubjectOverride', Ticket => $TicketObj, ARGSRef => \%ARGS, results => \@results );
223 unless($DefaultStatus){
224 $DefaultStatus=($ARGS{'Status'} ||$TicketObj->Status());
227 my $title = loc("Update ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject||'');
229 # Things needed in the template - we'll do the processing here, just
230 # for the convenience:
232 my ($CommentDefault, $ResponseDefault);
233 if ($Action ne 'Respond') {
234 $CommentDefault = qq[ selected="selected"];
235 $ResponseDefault = "";
237 $CommentDefault = "";
238 $ResponseDefault = qq[ selected="selected"];
241 my $type = $ARGS{'UpdateType'} ? $ARGS{'UpdateType'} :
242 lc $Action eq 'respond' ? 'response' :
243 lc $Action eq 'comment' ? 'private' :
247 $CanRespond = 1 if ( $TicketObj->CurrentUserHasRight('ReplyToTicket') or
248 $TicketObj->CurrentUserHasRight('ModifyTicket') );
250 $CanComment = 1 if ( $TicketObj->CurrentUserHasRight('CommentOnTicket') or
251 $TicketObj->CurrentUserHasRight('ModifyTicket') );
253 ProcessAttachments(ARGSRef => \%ARGS);
255 my $gnupg_widget = $m->comp('/Elements/Crypt/SignEncryptWidget:new', Arguments => \%ARGS );
256 $m->comp( '/Elements/Crypt/SignEncryptWidget:Process',
257 self => $gnupg_widget,
258 TicketObj => $TicketObj,
261 if ( $ARGS{'SubmitTicket'} ) {
263 my %squelched = ProcessTransactionSquelching( \%ARGS );
264 $ARGS{'SquelchMailTo'} = [keys %squelched] if keys %squelched;
266 my ($status, @msg) = $m->comp(
267 '/Elements/ValidateCustomFields',
268 CustomFields => $TicketObj->TransactionCustomFields,
269 Object => RT::Transaction->new( $session{'CurrentUser'} ),
276 $status = $m->comp('/Elements/Crypt/SignEncryptWidget:Check',
277 self => $gnupg_widget,
278 TicketObj => $TicketObj,
280 $checks_failure = 1 unless $status;
283 # check email addresses for RT's
285 foreach my $field ( qw(UpdateCc UpdateBcc) ) {
286 my $value = $ARGS{ $field };
287 next unless defined $value && length $value;
289 my @emails = Email::Address->parse( $value );
290 foreach my $email ( grep RT::EmailParser->IsRTAddress($_->address), @emails ) {
291 push @results, loc("[_1] is an address RT receives mail at. Adding it as a '[_2]' would create a mail loop", $email->format, loc(substr($field, 6)) );
295 $ARGS{ $field } = join ', ', map $_->format, grep defined, @emails;
299 $m->callback( CallbackName => 'BeforeUpdate', ARGSRef => \%ARGS, skip_update => \$skip_update,
300 checks_failure => $checks_failure, results => \@results, TicketObj => $TicketObj );
302 if ( !$checks_failure && !$skip_update && exists $ARGS{SubmitTicket} ) {
303 $m->callback( Ticket => $TicketObj, ARGSRef => \%ARGS, CallbackName => 'BeforeDisplay' );
304 return $m->comp('Display.html', TicketObj => $TicketObj, %ARGS);
311 $DefaultStatus => undef