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 => loc("Bulk ticket update") &>
25 <& /Elements/Tabs, Title => loc("Bulk ticket update") &>
27 <& /Elements/ListActions, actions => \@results &>
30 <TABLE WIDTH=100% border=0 cellpadding=3 CELLSPACING=0>
32 <TH><&|/l&>Update</&></TH>
33 %foreach my $col (@cols) {
34 % my $colalias = $col;
35 % $colalias =~ s/(Obj\-\>|)(Name|AsString)//;
37 <TH><% loc($colalias) %> </TH>
47 $session{'tickets'}->RedoSearch();
48 while (my $Ticket = $session{'tickets'}->Next) {
57 <TR bgcolor="<%$bgcolor%>">
58 <TD><input type=checkbox name="UpdateTicket<%$Ticket->Id%>" CHECKED></TD>
59 %# The ticket view is controlled by config.pm, WebOptions
60 %foreach my $col (@cols) {
63 <A HREF="<% $RT::WebPath%>/Ticket/Display.html?id=<%$Ticket->Id%>"><%$Ticket->Id()%></A>
66 <% eval "\$Ticket->$col()" %>
80 <& /Elements/TitleBoxStart, title => loc('Update selected tickets') &>
85 <tr><td class=label> <&|/l&>Make Owner</&>: </td>
86 <td class=value> <& /Elements/SelectOwner, Name => "Owner" &> (<input type=checkbox name="ForceOwnerChange"> <&|/l&>Force change</&>) </td></tr>
87 <tr><td class=label> <&|/l&>Add Requestor</&>: </td>
88 <td class=value> <INPUT Name="AddRequestor" SIZE=20> </td></tr>
89 <tr><td class=label> <&|/l&>Remove Requestor</&>: </td>
90 <td class=value> <INPUT Name="DeleteRequestor" SIZE=20> </td></tr>
91 <tr><td class=label> <&|/l&>Add Cc</&>: </td>
92 <td class=value> <INPUT Name="AddCc" SIZE=20> </td></tr>
93 <tr><td class=label> <&|/l&>Remove Cc</&>: </td>
94 <td class=value> <INPUT Name="DeleteCc" SIZE=20> </td></tr>
95 <tr><td class=label> <&|/l&>Add AdminCc</&>: </td>
96 <td class=value> <INPUT Name="AddAdminCc" SIZE=20> </td></tr>
97 <tr><td class=label> <&|/l&>Remove AdminCc</&>: </td>
98 <td class=value> <INPUT Name="DeleteAdminCc" SIZE=20> </td></tr>
103 <tr><td class=label> <&|/l&>Make subject</&>: </td>
104 <td class=value> <INPUT Name="Subject" SIZE=20> </td></tr>
105 <tr><td class=label> <&|/l&>Make priority</&>: </td>
106 <td class=value> <INPUT Name="Priority" SIZE=4> </td></tr>
107 <tr><td class=label> <&|/l&>Make queue</&>: </td>
108 <td class=value> <& /Elements/SelectQueue, Name => "Queue" &> </td></tr>
109 <tr><td class=label> <&|/l&>Make Status</&>: </td>
110 <td class=value> <& /Elements/SelectStatus, Name => "Status" &> </td></tr>
111 <tr><td class=label> <&|/l&>Make date Starts</&>: </td>
112 <td class=value> <& /Elements/SelectDate, Name => "Starts_Date", ShowTime => 0, Default => '' &> </td></tr>
113 <tr><td class=label> <&|/l&>Make date Started</&>: </td>
114 <td class=value> <& /Elements/SelectDate, Name => "Started_Date", ShowTime => 0, Default => '' &> </td></tr>
115 <tr><td class=label> <&|/l&>Make date Told</&>: </td>
116 <td class=value> <& /Elements/SelectDate, Name => "Told_Date", ShowTime => 0, Default => '' &> </td></tr>
117 <tr><td class=label> <&|/l&>Make date Due</&>: </td>
118 <td class=value> <& /Elements/SelectDate, Name => "Due_Date", ShowTime => 0, Default => '' &> </td></tr>
119 <tr><td class=label> <&|/l&>Make date Resolved</&>: </td>
120 <td class=value> <& /Elements/SelectDate, Name => "Resolved_Date", ShowTime => 0, Default => '' &> </td></tr>
126 <& /Elements/TitleBoxEnd&>
127 <& /Elements/TitleBoxStart, title => loc('Add comments or replies to selected tickets') &>
129 <tr><td align=right><&|/l&>Update Type</&>:</td>
130 <td><select name="UpdateType">
131 <option value="private" ><&|/l&>Comments (not sent to requestors)</&></option>
132 <option value="response" ><&|/l&>Response to requestors</&></option>
135 <tr><td align=right><&|/l&>Subject</&>:</td><td> <input name="UpdateSubject" size=60 value=""></td></tr>
136 <tr><td align=right><&|/l&>Attach</&>:</td><td><input name="UpdateAttachment" type="file"></td></tr>
137 <tr><td class=labeltop><&|/l&>Message</&>:</td><td>
138 <& /Elements/MessageBox, Name=>"UpdateContent"&>
141 <& /Elements/TitleBoxEnd &>
143 <& /Elements/TitleBoxStart, title => loc('Edit Relationships'), color => "#336633"&>
144 <i><&|/l&>Enter tickets or URIs to link tickets to. Seperate multiple entries with spaces.</&></i><br>
145 <& /Ticket/Elements/BulkLinks &>
146 <& /Elements/TitleBoxEnd &>
148 <& /Elements/Submit &>
154 # Iterate through the ARGS hash and remove anything with a null value.
155 map ($ARGS{$_} =~ /^$/ && (delete $ARGS{$_}), keys %ARGS);
157 my ($bgcolor, @results);
158 my @cols = qw(id Status Priority Subject QueueObj->Name OwnerObj->Name RequestorAddresses DueAsString );
160 Abort(loc("No search to operate on.")) unless ($session{'tickets'});
163 my $do_comment_reply=0;
164 # Prepare for ticket updates
165 $ARGS{'UpdateContent'} =~ s/\r\n/\n/g;
166 chomp ($ARGS{'UpdateContent'}) ;
168 if ($ARGS{'UpdateContent'} &&
169 $ARGS{'UpdateContent'} ne '' &&
170 $ARGS{'UpdateContent'} ne "-- \n" .
171 $session{'CurrentUser'}->UserObj->Signature) {
175 #Iterate through each ticket we've been handed
178 while (my $Ticket = $session{'tickets'}->Next) {
179 $RT::Logger->debug( "Checking Ticket ".$Ticket->Id ."\n");
180 next unless ($ARGS{"UpdateTicket".$Ticket->Id});
181 $RT::Logger->debug ("Matched\n");
183 my @basicresults = ProcessTicketBasics(TicketObj => $Ticket, ARGSRef => \%ARGS);
184 my @dateresults = ProcessTicketDates(TicketObj => $Ticket, ARGSRef => \%ARGS);
186 my @watchresults = ProcessTicketWatchers(TicketObj => $Ticket, ARGSRef => \%ARGS);
189 $ARGS{'id'} = $Ticket;
190 $ARGS{$Ticket->Id.'-MergeInto'} = $ARGS{'Ticket-MergeInto'};
191 $ARGS{$Ticket->Id.'-DependsOn'} = $ARGS{'Ticket-DependsOn'};
192 $ARGS{'DependsOn-'.$Ticket->Id} = $ARGS{'DependsOn-Ticket'};
193 $ARGS{$Ticket->Id.'-MemberOf'} = $ARGS{'Ticket-MemberOf'};
194 $ARGS{'MemberOf-'.$Ticket->Id} = $ARGS{'MemberOf-Ticket'};
195 $ARGS{$Ticket->Id.'-RefersTo'} = $ARGS{'Ticket-RefersTo'};
196 $ARGS{'RefersTo-'.$Ticket->Id} = $ARGS{'RefersTo-Ticket'};
197 @linkresults = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
199 delete $ARGS{$Ticket->Id.'-MergeInto'};
200 delete $ARGS{$Ticket->Id.'-DependsOn'};
201 delete $ARGS{'DependsOn-'.$Ticket->Id};
202 delete $ARGS{$Ticket->Id.'-MemberOf'};
203 delete $ARGS{'MemberOf-'.$Ticket->Id};
204 delete $ARGS{$Ticket->Id.'-RefersTo'};
205 delete $ARGS{'RefersTo-'.$Ticket->Id};
208 if ($do_comment_reply) {
209 ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef => \%ARGS, Actions => \@updateresults);
211 my @tempresults = (@watchresults, @basicresults, @dateresults, @updateresults, @linkresults);
212 @tempresults = map { loc("Ticket [_1]: [_2]",$Ticket->Id,$_) } @tempresults;
214 @results = (@results, @tempresults);