From d39d52aac8f38ea9115628039f0df5aa3ac826de Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 3 Dec 2004 20:40:48 +0000 Subject: import rt 3.2.2 --- rt/html/Search/Bulk.html | 118 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 100 insertions(+), 18 deletions(-) (limited to 'rt/html/Search/Bulk.html') 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 +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# %# -%# (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) { <&|/l&>Update Type: <&|/l&>Subject: @@ -138,9 +158,38 @@ while (my $Ticket = $session{'tickets'}->Next) { <& /Elements/MessageBox, Name=>"UpdateContent"&> + + +% foreach (keys %allcfs) { + + + +% } +
+% my $cf = $allcfs{$_}; +% my $pref; +% if ($cf->Queue == 0) { +% $pref = "[Global]"; +% } else { +% $pref = "[Queue: " . $cfqnames{$_} . "]"; +% } +<%$pref%> <% $cf->Name %>
+<% $cf->FriendlyType %> +
+% if ($cf->Type ne "FreeformMultiple") { +<& /Ticket/Elements/EditCustomField, CustomField => $cf &> +% } else { +Add Values
+ +
+Delete Values
+ +% } +
+ <& /Elements/TitleBoxEnd &> -<& /Elements/TitleBoxStart, title => loc('Edit Relationships'), color => "#336633"&> +<& /Elements/TitleBoxStart, title => loc('Edit Links'), color => "#336633"&> <&|/l&>Enter tickets or URIs to link tickets to. Seperate multiple entries with spaces.
<& /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); -- cgit v1.2.1