3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
5 %# (Except where explictly superceded by other copyright notices)
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
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.
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.
24 <& /Elements/Header, Title => $title &>
25 <& /Ticket/Elements/Tabs,
29 <FORM ACTION="Update.html" NAME="TicketUpdate"
30 METHOD=POST enctype="multipart/form-data">
31 <input type="hidden" name="QuoteTransaction" value="<% $ARGS{QuoteTransaction} %>">
32 <input type="hidden" name="DefaultStatus" value="<% $DefaultStatus %>">
33 <input type="hidden" name="Action" value="<% $ARGS{Action} %>">
38 <a href="ModifyPeople.html?id=<%$TicketObj->Id%>"><&|/l&>Ticket watchers</&></A></TD><TD align=right>
41 <b><% $TicketObj->RequestorAddresses %></b>
43 <TR><TD> </TD><TD align=right>
46 <b><% $TicketObj->CcAddresses %></b>
48 <TR><TD> </TD><TD align=right>
51 <b><% $TicketObj->AdminCcAddresses %></b>
59 <tr><td align=right><&|/l&>Status</&>:</td>
61 <& /Elements/SelectStatus, Name=>"Status", Default => $DefaultStatus &>
63 <& /Elements/SelectOwner, Name=>"Owner", Default => ($ARGS{'Owner'} || $TicketObj->OwnerObj->Id()), QueueObj => $TicketObj->QueueObj, TicketObj => $TicketObj &>
64 <&|/l&>Worked</&>: <input size=4 name="UpdateTimeWorked" value="<% $ARGS{UpdateTimeWorked}%>"> <&|/l&>minutes</&></td></tr>
65 <tr><td align=right><&|/l&>Update Type</&>:</td>
66 <td><select name="UpdateType">
68 <option value="private" <%$CommentDefault%>><&|/l&>Comments (Not sent to requestors)</&></option>
71 <option value="response" <%$ResponseDefault%>><&|/l&>Response to requestors</&></option>
75 <tr><td align=right><&|/l&>Subject</&>:</td><td> <input name="UpdateSubject" size=60 value="<% ($ARGS{UpdateSubject}) ? $ARGS{UpdateSubject} : $TicketObj->Subject()%>"></td></tr>
76 <tr><td align=right><&|/l&>Cc</&>:</td><td> <input name="UpdateCc" size=60
77 value=<% $ARGS{UpdateCc} %>><BR>
79 <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of email addresses. Does <b>not</b> change who will receive future updates.)</&></font></i>
81 <tr><td align=right><&|/l&>Bcc</&>:</td><td> <input name="UpdateBcc" size=60 VALUE="<%$ARGS{UpdateBcc}%>"><BR>
83 <&|/l&>(Sends a blind carbon-copy of this update to a comma-delimited list of email addresses. Does <b>not</b> change who will receive future updates.)</&></font></i>
85 % if (exists $session{'Attachments'}) {
87 <&|/l&>Attached file</&>:
90 <&|/l&>Check box to delete</&><BR>
91 % foreach my $attach_name (keys %{$session{'Attachments'}}) {
92 <input type="checkbox" name="DeleteAttach-<%$attach_name%>"><%$attach_name%><BR>
98 <tr><td align=right><&|/l&>Attach</&>:</td><td><input name="Attach" type="file"><INPUT TYPE=SUBMIT NAME="AddMoreAttach" VALUE="<&|/l&>Add More Files</&>"><input type="hidden" name="UpdateAttach" value="1">
100 <tr><td align="right" valign="top"><&|/l&>Message</&>:</td><td>
101 <& /Elements/Callback, _CallbackName => 'BeforeMessageBox', %ARGS &>
102 % if (exists $ARGS{UpdateContent}) {
103 % delete $ARGS{'QuoteTransaction'};
104 <& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{UpdateContent}, IncludeSignature => 0, %ARGS&>
106 <& /Elements/MessageBox, Name=>"UpdateContent", %ARGS &>
109 <INPUT TYPE=HIDDEN NAME=id VALUE="<%$TicketObj->Id%>"><br>
115 <& /Elements/Submit, Label => loc('Update Ticket'), Name => 'SubmitTicket' &>
126 my $TicketObj = LoadTicket($id);
128 unless($DefaultStatus){
129 $DefaultStatus=($ARGS{'Status'} ||$TicketObj->Status());
132 if ($DefaultStatus =~ '^new$'){
133 $DefaultStatus='open';
136 if ($DefaultStatus eq 'resolved') {
137 $title = loc("Resolve ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject);
139 $title = loc("Update ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject);
142 # Things needed in the template - we'll do the processing here, just
143 # for the convenience:
145 my ($CommentDefault, $ResponseDefault);
146 if (($Action eq 'Comment') or ($ARGS{'UpdateType'} eq 'private')) {
147 $CommentDefault = "SELECTED";
149 $ResponseDefault = "SELECTED";
153 $CanRespond = 1 if ( $TicketObj->CurrentUserHasRight('ReplyToTicket') or
154 $TicketObj->CurrentUserHasRight('ModifyTicket') );
156 $CanComment = 1 if ( $TicketObj->CurrentUserHasRight('CommentOnTicket') or
157 $TicketObj->CurrentUserHasRight('ModifyTicket') );
160 # {{{ deal with deleting uploaded attachments
161 foreach my $key (keys %ARGS) {
162 if ($key =~ m/^DeleteAttach-(.+)$/) {
163 delete $session{'Attachments'}{$1};
165 $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
168 # {{{ store the uploaded attachment in session
169 if ($ARGS{'Attach'}) { # attachment?
170 $session{'Attachments'} = {} unless defined $session{'Attachments'};
172 my $subject = "$ARGS{'Attach'}";
173 # since CGI.pm deutf8izes the magic field, we need to add it back.
174 Encode::_utf8_on($subject);
175 # strip leading directories
176 $subject =~ s#^.*[\\/]##;
178 my $attachment = MakeMIMEEntity(
181 AttachmentFieldName => 'Attach'
184 $session{'Attachments'} = { %{$session{'Attachments'} || {}},
185 $ARGS{'Attach'} => $attachment };
189 # delete temporary storage entry to make WebUI clean
190 unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
191 delete $session{'Attachments'};
195 if ( exists $ARGS{SubmitTicket} ) {
196 $m->comp('Display.html', TicketObj => $TicketObj, %ARGS);
204 $DefaultStatus => undef