diff options
Diffstat (limited to 'rt/html/Search/Bulk.html')
-rw-r--r-- | rt/html/Search/Bulk.html | 118 |
1 files changed, 100 insertions, 18 deletions
diff --git a/rt/html/Search/Bulk.html b/rt/html/Search/Bulk.html index 9ecac494f..f75934bf3 100644 --- a/rt/html/Search/Bulk.html +++ b/rt/html/Search/Bulk.html @@ -1,8 +1,14 @@ -%# BEGIN LICENSE BLOCK +%# {{{ BEGIN BPS TAGGED BLOCK %# -%# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> %# -%# (Except where explictly superceded by other copyright notices) +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: %# %# This work is made available to you under the terms of Version 2 of %# the GNU General Public License. A copy of that license should have @@ -14,13 +20,29 @@ %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU %# General Public License for more details. %# -%# Unless otherwise specified, all modifications, corrections or -%# extensions to this work which alter its source code become the -%# property of Best Practical Solutions, LLC when submitted for -%# inclusion in the work. +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) %# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. %# -%# END LICENSE BLOCK +%# }}} END BPS TAGGED BLOCK <& /Elements/Header, Title => loc("Bulk ticket update") &> <& /Elements/Tabs, Title => loc("Bulk ticket update") &> @@ -42,10 +64,8 @@ my $i; - - -$session{'tickets'}->RedoSearch(); -while (my $Ticket = $session{'tickets'}->Next) { +$Tickets->RedoSearch(); +while (my $Ticket = $Tickets->Next) { $i++; if ($i % 2) { $bgcolor = "#dddddd"; @@ -129,7 +149,7 @@ while (my $Ticket = $session{'tickets'}->Next) { <tr><td align=right><&|/l&>Update Type</&>:</td> <td><select name="UpdateType"> <option value="private" ><&|/l&>Comments (not sent to requestors)</&></option> -<option value="response" ><&|/l&>Response to requestors</&></option> +<option value="response" ><&|/l&>Reply to requestors</&></option> </select> </td></tr> <tr><td align=right><&|/l&>Subject</&>:</td><td> <input name="UpdateSubject" size=60 value=""></td></tr> @@ -138,9 +158,38 @@ while (my $Ticket = $session{'tickets'}->Next) { <& /Elements/MessageBox, Name=>"UpdateContent"&> </td></tr> </table> + +<table> +% foreach (keys %allcfs) { +<tr><td class=label> +% my $cf = $allcfs{$_}; +% my $pref; +% if ($cf->Queue == 0) { +% $pref = "[Global]"; +% } else { +% $pref = "[Queue: " . $cfqnames{$_} . "]"; +% } +<%$pref%> <b><% $cf->Name %></b><br> +<% $cf->FriendlyType %> +</td> +<td> +% if ($cf->Type ne "FreeformMultiple") { +<& /Ticket/Elements/EditCustomField, CustomField => $cf &> +% } else { +Add Values<br> +<textarea cols=15 rows=3 name="<%$cf->Id%>-Values"></textarea> +</td><td> +Delete Values<br> +<textarea cols=15 rows=3 name="<%$cf->Id%>-DeleteValues"></textarea> +% } +</td> +</tr> +% } +</table> + <& /Elements/TitleBoxEnd &> -<& /Elements/TitleBoxStart, title => loc('Edit Relationships'), color => "#336633"&> +<& /Elements/TitleBoxStart, title => loc('Edit Links'), color => "#336633"&> <i><&|/l&>Enter tickets or URIs to link tickets to. Seperate multiple entries with spaces.</&></i><br> <& /Ticket/Elements/BulkLinks &> <& /Elements/TitleBoxEnd &> @@ -157,8 +206,30 @@ map ($ARGS{$_} =~ /^$/ && (delete $ARGS{$_}), keys %ARGS); my ($bgcolor, @results); my @cols = qw(id Status Priority Subject QueueObj->Name OwnerObj->Name RequestorAddresses DueAsString ); -Abort(loc("No search to operate on.")) unless ($session{'tickets'}); +my $Tickets = RT::Tickets->new($session{'CurrentUser'}); +$Tickets->FromSQL($ARGS{'Query'}); + +Abort(loc("No search to operate on.")) unless ($Tickets); + +my %allcfs; +my %cfqnames; +my %cfqs; +my $count = 0; +while (my $Ticket = $Tickets->Next) { + my $cfq = $Ticket->QueueObj; + my $cfqid = $cfq->Id; + my $cfqn = $cfq->Name; + unless ( exists $cfqs{$cfqid} ) { + $cfqs{$cfqid} = 1; + $count++; + my $cfs = $cfq->CustomFields; + while (my $cf = $cfs->Next) { + $allcfs{$cf->Id} = $cf; + $cfqnames{$cf->Id} = $cfqn; + } + } +} my $do_comment_reply=0; # Prepare for ticket updates @@ -175,8 +246,8 @@ if ($ARGS{'UpdateContent'} && #Iterate through each ticket we've been handed my @linkresults; -$session{'tickets'}->RedoSearch(); -while (my $Ticket = $session{'tickets'}->Next) { +$Tickets->RedoSearch(); +while (my $Ticket = $Tickets->Next) { $RT::Logger->debug( "Checking Ticket ".$Ticket->Id ."\n"); next unless ($ARGS{"UpdateTicket".$Ticket->Id}); $RT::Logger->debug ("Matched\n"); @@ -191,6 +262,17 @@ while (my $Ticket = $session{'tickets'}->Next) { #Update the watchers my @watchresults = ProcessTicketWatchers(TicketObj => $Ticket, ARGSRef => \%ARGS); + #Update custom fields + my $pat = "^(\\d+)-(.*)\$"; + foreach (keys %ARGS) { + $ARGS{"Ticket-" . $Ticket->Id . "-CustomField-" . $1 . "-" . $2} = $ARGS{$_} if (/$pat/o); + } + my @cfresults = ProcessTicketCustomFieldUpdates(ARGSRef => \%ARGS); + foreach (keys %ARGS) { + delete $ARGS{"Ticket-" . $Ticket->Id . "-CustomField-" . $1 . "-" . $2} if (/$pat/o); + } + + #Update the links $ARGS{'id'} = $Ticket; $ARGS{$Ticket->Id.'-MergeInto'} = $ARGS{'Ticket-MergeInto'}; @@ -210,7 +292,7 @@ while (my $Ticket = $session{'tickets'}->Next) { delete $ARGS{$Ticket->Id.'-RefersTo'}; delete $ARGS{'RefersTo-'.$Ticket->Id}; - my @tempresults = (@watchresults, @basicresults, @dateresults, @updateresults, @linkresults); + my @tempresults = (@watchresults, @basicresults, @dateresults, @updateresults, @linkresults, @cfresults); @tempresults = map { loc("Ticket [_1]: [_2]",$Ticket->Id,$_) } @tempresults; @results = (@results, @tempresults); |