import rt 3.4.4
[freeside.git] / rt / html / Search / Bulk.html
index f75934b..f9eef26 100644 (file)
@@ -1,8 +1,8 @@
-%# {{{ BEGIN BPS TAGGED BLOCK
+%# BEGIN BPS TAGGED BLOCK {{{
 %# 
 %# COPYRIGHT:
 %#  
-%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC 
 %#                                          <jesse@bestpractical.com>
 %# 
 %# (Except where explicitly superseded by other copyright notices)
 %# works based on those contributions, and sublicense and distribute
 %# those contributions and any derivatives thereof.
 %# 
-%# }}} END BPS TAGGED BLOCK
+%# END BPS TAGGED BLOCK }}}
 <& /Elements/Header, Title => loc("Bulk ticket update") &>
 <& /Elements/Tabs, Title => loc("Bulk ticket update") &>
 
 <& /Elements/ListActions, actions => \@results &>
-
-<FORM METHOD=POST>
+<FORM METHOD="POST" ACTION="<%$RT::WebPath%>/Search/Bulk.html" >
+<input type="hidden" name="Query" value="<%$ARGS{'Query'}%>">
 <TABLE WIDTH=100% border=0 cellpadding=3 CELLSPACING=0>
 <TR>
 <TH><&|/l&>Update</&></TH>
@@ -75,8 +75,7 @@ while (my $Ticket = $Tickets->Next) {
  }
       </%PERL>
 <TR bgcolor="<%$bgcolor%>">
-<TD><input type=checkbox name="UpdateTicket<%$Ticket->Id%>" CHECKED></TD>
-%# The ticket view is controlled by config.pm, WebOptions
+<TD><input type=checkbox name="UpdateTicket<%$Ticket->Id%>" value="1" CHECKED></TD>
 %foreach my $col (@cols) {
 <TD>
 % if ($col eq 'id') {
@@ -153,44 +152,26 @@ while (my $Ticket = $Tickets->Next) {
 </select> 
 </td></tr>
 <tr><td align=right><&|/l&>Subject</&>:</td><td> <input name="UpdateSubject" size=60 value=""></td></tr>
+% while (my $CF = $TxnCFs->Next()) {
+<TR>
+<TD ALIGN=RIGHT><% $CF->Name %>:</TD>
+<TD><& /Elements/EditCustomField, 
+    CustomField => $CF, 
+    NamePrefix => "Object-RT::Transaction--CustomField-"
+    &><em><% $CF->FriendlyType %></em></TD>
+</TD></TR>
+% } # end if while
  <tr><td align=right><&|/l&>Attach</&>:</td><td><input name="UpdateAttachment" type="file"></td></tr>
  <tr><td class=labeltop><&|/l&>Message</&>:</td><td>
  <& /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 Links'), color => "#336633"&>
-<i><&|/l&>Enter tickets or URIs to link tickets to. Seperate multiple entries with spaces.</&></i><br>
+<i><&|/l&>Enter tickets or URIs to link tickets to. Separate multiple entries with spaces.</&></i><br>
 <& /Ticket/Elements/BulkLinks &>
 <& /Elements/TitleBoxEnd &>
 
@@ -223,7 +204,7 @@ while (my $Ticket = $Tickets->Next) {
     unless ( exists $cfqs{$cfqid} ) {
        $cfqs{$cfqid} = 1;
        $count++;
-       my $cfs = $cfq->CustomFields;
+       my $cfs = $cfq->TicketCustomFields;
        while (my $cf = $cfs->Next) {
            $allcfs{$cf->Id} = $cf;
            $cfqnames{$cf->Id} = $cfqn;
@@ -245,9 +226,11 @@ if ($ARGS{'UpdateContent'} &&
 
 #Iterate through each ticket we've been handed
 my @linkresults;
+my %queues;
 
 $Tickets->RedoSearch();
 while (my $Ticket = $Tickets->Next) {
+    $queues{$Ticket->QueueObj->Id}++;
     $RT::Logger->debug( "Checking Ticket ".$Ticket->Id ."\n");
     next unless ($ARGS{"UpdateTicket".$Ticket->Id});
     $RT::Logger->debug ("Matched\n");
@@ -262,16 +245,6 @@ while (my $Ticket = $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;
@@ -291,11 +264,15 @@ while (my $Ticket = $Tickets->Next) {
     delete $ARGS{'MemberOf-'.$Ticket->Id};
     delete $ARGS{$Ticket->Id.'-RefersTo'};
     delete $ARGS{'RefersTo-'.$Ticket->Id};
-    
-    my @tempresults = (@watchresults, @basicresults, @dateresults, @updateresults, @linkresults, @cfresults);
+    my @tempresults = (@watchresults, @basicresults, @dateresults,
+    @updateresults, @linkresults);
     @tempresults = map { loc("Ticket [_1]: [_2]",$Ticket->Id,$_) } @tempresults;
 
     @results = (@results, @tempresults);
 }
 
+my $TxnCFs = RT::CustomFields->new($session{CurrentUser});
+$TxnCFs->LimitToLookupType("RT::Queue-RT::Ticket-RT::Transaction");
+$TxnCFs->LimitToGlobalOrObjectId(sort keys %queues);
+
 </%INIT>