]>
Commit | Line | Data |
---|---|---|
84fb5b46 MKG |
1 | %# BEGIN BPS TAGGED BLOCK {{{ |
2 | %# | |
3 | %# COPYRIGHT: | |
4 | %# | |
320f0092 | 5 | %# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC |
84fb5b46 MKG |
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="hidden" class="hidden" name="id" value="<%$Ticket->Id%>" /> | |
af59614d | 57 | <input type="hidden" class="hidden" name="Token" value="<% $ARGS{'Token'} %>" /> |
84fb5b46 MKG |
58 | |
59 | <&| /Widgets/TitleBox, title => loc('Modify ticket # [_1]', $Ticket->Id), class=>'ticket-info-basics' &> | |
af59614d MKG |
60 | <& Elements/EditBasics, TicketObj => $Ticket, defaults => \%ARGS &> |
61 | <& /Elements/EditCustomFields, Object => $Ticket, Grouping => 'Basics' &> | |
84fb5b46 MKG |
62 | </&> |
63 | ||
64 | % $m->callback(CallbackName => 'AfterBasics', Ticket => $Ticket); | |
af59614d MKG |
65 | |
66 | <& /Elements/EditCustomFieldCustomGroupings, Object => $Ticket &> | |
84fb5b46 MKG |
67 | |
68 | <&| /Widgets/TitleBox, title => loc('Dates'), class=>'ticket-info-dates'&> | |
69 | <& Elements/EditDates, TicketObj => $Ticket &> | |
70 | </&> | |
71 | ||
72 | <br /> | |
73 | ||
74 | ||
75 | <&| /Widgets/TitleBox, title => loc('People'), class=>'ticket-info-people' &> | |
76 | <& Elements/EditPeople, Ticket => $Ticket, UserField => $UserField, UserString => $UserString, UserOp => $UserOp, GroupString => $GroupString, GroupOp => $GroupOp, GroupField => $GroupField &> | |
77 | </&> | |
78 | ||
79 | <br /> | |
80 | ||
81 | <&| /Widgets/TitleBox, title => loc('Links'), class=>'ticket-info-links' &> | |
af59614d MKG |
82 | <& /Elements/EditLinks, Object => $Ticket &> |
83 | </&> | |
84 | ||
85 | <br /> | |
86 | ||
87 | <&| /Widgets/TitleBox, title => loc('Merge'), class=>'ticket-info-merge' &> | |
88 | <& Elements/EditMerge, Ticket => $Ticket, %ARGS &> | |
84fb5b46 MKG |
89 | </&> |
90 | ||
91 | <br /> | |
92 | ||
93 | <&| /Widgets/TitleBox, title => loc('Update ticket') &> | |
94 | <table> | |
95 | <tr> | |
96 | <td class="label"><&|/l&>Update Type</&>:</td> | |
97 | <td class="entry"> | |
98 | <select name="UpdateType"> | |
99 | % if ($CanComment) { | |
100 | <option value="private" ><&|/l&>Comments (Not sent to requestors)</&></option> | |
101 | % } | |
102 | % if ($CanRespond) { | |
103 | <option value="response"><&|/l&>Reply to requestors</&></option> | |
104 | % } | |
105 | </select> | |
106 | % $m->callback( %ARGS, CallbackName => 'AfterUpdateType' ); | |
107 | </td> | |
108 | </tr> | |
109 | <tr> | |
110 | <td class="label"><&|/l&>Subject</&>:</td> | |
111 | <td class="entry"><input name="UpdateSubject" size="60" value="<%$Ticket->Subject%>" /> | |
112 | % $m->callback( %ARGS, CallbackName => 'AfterSubject' ); | |
113 | </td> | |
114 | </tr> | |
115 | ||
116 | <tr><td colspan="2"><& /Ticket/Elements/EditTransactionCustomFields, %ARGS, TicketObj => $Ticket &></td></tr> | |
117 | ||
118 | <& /Ticket/Elements/AddAttachments, %ARGS, TicketObj => $Ticket &> | |
119 | ||
120 | <tr> | |
121 | <td class="labeltop"><&|/l&>Content</&>:</td> | |
122 | <td class="entry"> | |
af59614d | 123 | % if (defined $ARGS{UpdateContent} && length($ARGS{UpdateContent})) { |
84fb5b46 MKG |
124 | <& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{UpdateContent}, IncludeSignature => 0 &> |
125 | % } else { | |
126 | <& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &> | |
127 | % } | |
128 | </td></tr> | |
129 | </table> | |
130 | </&> | |
131 | ||
132 | ||
133 | <& /Elements/Submit, | |
134 | Name => 'SubmitTicket', | |
135 | Label => loc('Save Changes'), | |
136 | Caption => loc("If you've updated anything above, be sure to"), color => "#333399" &> | |
137 | </form> | |
138 | ||
320f0092 MKG |
139 | % $m->callback(CallbackName => 'AfterForm', ARGSRef => \%ARGS, Ticket => $Ticket); |
140 | ||
84fb5b46 MKG |
141 | <%INIT> |
142 | ||
143 | ||
144 | ||
145 | my $Ticket = LoadTicket($id); | |
146 | my $CustomFields = $Ticket->CustomFields; | |
147 | ||
84fb5b46 MKG |
148 | my $CanRespond = 0; |
149 | my $CanComment = 0; | |
150 | ||
151 | ||
152 | $CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or | |
153 | $Ticket->CurrentUserHasRight('ModifyTicket') ); | |
154 | ||
155 | $CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or | |
156 | $Ticket->CurrentUserHasRight('ModifyTicket') ); | |
157 | ||
5b0d0914 | 158 | ProcessAttachments(ARGSRef => \%ARGS); |
84fb5b46 | 159 | |
84fb5b46 | 160 | my @results; |
af59614d MKG |
161 | my $skip_update = 0; |
162 | $m->callback( TicketObj => $Ticket, ARGSRef => \%ARGS, skip_update => \$skip_update ); | |
163 | ||
164 | { | |
165 | my ($status, @msg) = $m->comp( | |
166 | '/Elements/ValidateCustomFields', | |
167 | Object => $Ticket, | |
168 | CustomFields => $CustomFields, | |
169 | ARGSRef => \%ARGS, | |
170 | ); | |
171 | unless ($status) { | |
172 | push @results, @msg; | |
173 | $skip_update = 1; | |
174 | } | |
175 | } | |
84fb5b46 | 176 | |
af59614d MKG |
177 | # There might be two owners. |
178 | if ( ref ($ARGS{'Owner'} )) { | |
179 | my @owners =@{$ARGS{'Owner'}}; | |
180 | delete $ARGS{'Owner'}; | |
181 | foreach my $owner(@owners){ | |
182 | if (defined($owner) && $owner =~ /\D/) { | |
183 | $ARGS{'Owner'} = $owner unless ($Ticket->OwnerObj->Name eq $owner); | |
184 | } | |
185 | elsif (length $owner) { | |
186 | $ARGS{'Owner'} = $owner unless ($Ticket->OwnerObj->id == $owner); | |
84fb5b46 | 187 | } |
84fb5b46 | 188 | } |
af59614d | 189 | } |
84fb5b46 | 190 | |
af59614d | 191 | unless ($skip_update or $OnlySearchForPeople or $OnlySearchForGroup or $ARGS{'AddMoreAttach'} ) { |
84fb5b46 MKG |
192 | push @results, ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS); |
193 | push @results, ProcessObjectCustomFieldUpdates( Object => $Ticket, ARGSRef => \%ARGS); | |
194 | push @results, ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS); | |
84fb5b46 | 195 | push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS ); |
84fb5b46 MKG |
196 | push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS ); |
197 | push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS); | |
84fb5b46 | 198 | |
af59614d | 199 | $Ticket->ApplyTransactionBatch; |
84fb5b46 | 200 | |
af59614d MKG |
201 | MaybeRedirectForResults( |
202 | Actions => \@results, | |
203 | Path => "/Ticket/ModifyAll.html", | |
204 | Arguments => { id => $Ticket->id }, | |
205 | ); | |
206 | } | |
84fb5b46 | 207 | |
403d7b0b | 208 | # If they've gone and moved the ticket to somewhere they can't see, etc... |
84fb5b46 | 209 | unless ($Ticket->CurrentUserHasRight('ShowTicket')) { |
403d7b0b MKG |
210 | if (@results) { |
211 | Abort("A change was applied successfully, but you no longer have permissions to view the ticket", Actions => \@results); | |
212 | } else { | |
213 | Abort("No permission to view ticket"); | |
214 | } | |
84fb5b46 MKG |
215 | } |
216 | ||
217 | ||
218 | </%INIT> | |
219 | ||
220 | ||
221 | ||
222 | <%ARGS> | |
223 | $OnlySearchForPeople => undef | |
224 | $OnlySearchForGroup => undef | |
225 | $UserField => undef | |
226 | $UserOp => undef | |
227 | $UserString => undef | |
228 | $GroupString => undef | |
229 | $GroupOp => undef | |
230 | $GroupField => undef | |
231 | $id => undef | |
232 | </%ARGS> | |
233 |