[Rt-commit] [svn] r1297 - in rt/branches/3.2-RELEASE: html/Search
lib/RT/Interface
huberth at pallas.eruditorum.org
huberth at pallas.eruditorum.org
Fri Jul 30 17:46:44 EDT 2004
Author: huberth
Date: Fri Jul 30 17:46:43 2004
New Revision: 1297
Modified:
rt/branches/3.2-RELEASE/html/Search/Bulk.html
rt/branches/3.2-RELEASE/lib/RT/Interface/Web.pm
Log:
RT-Ticket: 5699
RT-Status: resolved
* Bulk editing of custom fields (finally!) added. Not quite as fast as
would be preferred, probably, but it (should) work.
Modified: rt/branches/3.2-RELEASE/html/Search/Bulk.html
==============================================================================
--- rt/branches/3.2-RELEASE/html/Search/Bulk.html (original)
+++ rt/branches/3.2-RELEASE/html/Search/Bulk.html Fri Jul 30 17:46:43 2004
@@ -158,6 +158,37 @@
<& /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 {
+% my $queue = RT::Queue->new($session{'CurrentUser'});
+% $queue->Load($cf->Queue);
+% $pref = "[Queue: " . $queue->Name . "]";
+% }
+<%$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 Links'), color => "#336633"&>
@@ -183,6 +214,21 @@
Abort(loc("No search to operate on.")) unless ($Tickets);
+my %allcfs;
+my %cfqs;
+my $count = 0;
+while (my $Ticket = $Tickets->Next) {
+ my $cfq = $Ticket->QueueObj;
+ my $cfqn = $cfq->Name;
+ if (!$cfqs{$cfqn}) {
+ $cfqs{$cfqn} = 1;
+ $count++;
+ my $cfs = $cfq->CustomFields;
+ while (my $cf = $cfs->Next) {
+ $allcfs{$cf->Id} = $cf;
+ }
+ }
+}
my $do_comment_reply=0;
# Prepare for ticket updates
@@ -215,6 +261,17 @@
#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'};
@@ -234,7 +291,7 @@
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);
Modified: rt/branches/3.2-RELEASE/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/3.2-RELEASE/lib/RT/Interface/Web.pm (original)
+++ rt/branches/3.2-RELEASE/lib/RT/Interface/Web.pm Fri Jul 30 17:46:43 2004
@@ -1088,6 +1088,11 @@
( ref( $ARGSRef->{$arg} ) eq 'ARRAY' )
? @{ $ARGSRef->{$arg} }
: split /\n/, $ARGSRef->{$arg} ;
+
+ #for poor windows boxen that pass in "\r\n"
+ local $/ = "\r";
+ chomp @values;
+
if ( ( $arg =~ /-AddValue$/ ) || ( $arg =~ /-Value$/ ) ) {
foreach my $value (@values) {
next unless length($value);
More information about the Rt-commit
mailing list