[rt-devel] Bulk Merge,Parent/Child,Refers Patch

Brook Schofield B.Schofield at mailbox.gu.edu.au
Wed Dec 4 00:40:55 EST 2002


After seeing Rob Mitzel query on Bulk Merge within RT:
         http://lists.fsck.com/pipermail/rt-users/2002-April/007623.html

and not finding any follow-up messages - I thought that I would post my own 
attempt at a solution.

3 diffs in total (sorry only have diff -c on this Sun box) the diff to 
Search/Bulk.html and then a diff without and with whitespace sensitivity to 
RT/Interface/Web.pm (not sure of the indentation requirements).

If this should be re-directed to another address please do so or get back 
to me.

There is no mass delete of any of the link events - yet!

Diffs are against - 2.1.53.

-Brook

*** Bulk.html.orig      Wed Dec  4 14:15:27 2002
--- Bulk.html   Wed Dec  4 15:07:28 2002
***************
*** 91,96 ****
--- 91,101 ----
   <li> <&|/l&>Remove Cc</&> <INPUT Name="DeleteCc" SIZE=20>
   <li> <&|/l&>Add AdminCc</&> <INPUT Name="AddAdminCc" SIZE=20>
   <li> <&|/l&>Remove AdminCc</&> <INPUT Name="DeleteAdminCc" SIZE=20>
+ <li> <&|/l&>Make date Starts</&> <& /Elements/SelectDate, Name => 
"Starts_Date", ShowTime => 0, Default => '' &>
+ <li> <&|/l&>Make date Started</&> <& /Elements/SelectDate, Name => 
"Started_Date", ShowTime => 0, Default => '' &>
+ <li> <&|/l&>Make date Told</&> <& /Elements/SelectDate, Name => 
"Told_Date", ShowTime => 0, Default => '' &>
+ <li> <&|/l&>Make date Due</&> <& /Elements/SelectDate, Name => 
"Due_Date", ShowTime => 0, Default => '' &>
+ <li> <&|/l&>Make date Resolved</&> <& /Elements/SelectDate, Name => 
"Resolved_Date", ShowTime => 0, Default => '' &>
   </UL>
   </TD>
   <TD VALIGN=TOP>
***************
*** 101,113 ****

   <li><&|/l&>Make Status</&> <& /Elements/SelectStatus, Name => "Status" &>


-
- <li> <&|/l&>Make date Starts</&> <& /Elements/SelectDate, Name => 
"Starts_Date", ShowTime => 0, Default => '' &>
- <li> <&|/l&>Make date Started</&> <& /Elements/SelectDate, Name => 
"Started_Date", ShowTime => 0, Default => '' &>
- <li> <&|/l&>Make date Told</&> <& /Elements/SelectDate, Name => 
"Told_Date", ShowTime => 0, Default => '' &>
- <li> <&|/l&>Make date Due</&> <& /Elements/SelectDate, Name => 
"Due_Date", ShowTime => 0, Default => '' &>
- <li> <&|/l&>Make date Resolved</&> <& /Elements/SelectDate, Name => 
"Resolved_Date", ShowTime => 0, Default => '' &>
   </UL>


--- 106,120 ----

   <li><&|/l&>Make Status</&> <& /Elements/SelectStatus, Name => "Status" &>

+ <li><i><&|/l&>Enter tickets or URIs to link tickets to. Seperate multiple 
entries with spaces.</&></i>
+ <li> <&|/l&>Merge into</&> <INPUT Name="bulk-MergeInto" SIZE=20> 
<i><&|/l&>(only one ticket)</&></i>
+ <li> <&|/l&>Depends on</&> <INPUT Name="bulk-DependsOn" SIZE=20>
+ <li> <&|/l&>Depended on by</&> <INPUT Name="DependsOn-bulk" SIZE=20>
+ <li> <&|/l&>Parents</&> <INPUT Name="bulk-MemberOf" SIZE=20>
+ <li> <&|/l&>Children</&> <INPUT Name="MemberOf-bulk" SIZE=20>
+ <li> <&|/l&>Refers to</&> <INPUT Name="bulk-RefersTo" SIZE=20>
+ <li> <&|/l&>Referred to by</&> <INPUT Name="RefersTo-bulk" SIZE=20>

   </UL>


***************
*** 172,183 ****
       my @dateresults = ProcessTicketDates(TicketObj => $Ticket, ARGSRef 
=> \%ARGS);
       #Update the watchers
       my @watchresults = ProcessTicketWatchers(TicketObj => $Ticket, 
ARGSRef => \%ARGS);

       my @updateresults;
       if ($do_comment_reply) {
       ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef => \%ARGS, 
Actions => \@updateresults);
      }
!    my @tempresults = (@watchresults, @basicresults, @dateresults, 
@updateresults);
       @tempresults = map { loc("Ticket [_1]: [_2]",$Ticket->Id,$_) } 
@tempresults;

       @results = (@results, @tempresults);
--- 179,192 ----
       my @dateresults = ProcessTicketDates(TicketObj => $Ticket, ARGSRef 
=> \%ARGS);
       #Update the watchers
       my @watchresults = ProcessTicketWatchers(TicketObj => $Ticket, 
ARGSRef => \%ARGS);
+     #Update the links (merge, memberOf, refers)
+     my @linkresults = ProcessTicketLinks(TicketObj => $Ticket, ARGSRef => 
\%ARGS);

       my @updateresults;
       if ($do_comment_reply) {
       ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef => \%ARGS, 
Actions => \@updateresults);
      }
!    my @tempresults = (@watchresults, @basicresults, @dateresults, 
@linkresults, @updateresults);
       @tempresults = map { loc("Ticket [_1]: [_2]",$Ticket->Id,$_) } 
@tempresults;

       @results = (@results, @tempresults);



*** Web.pm.orig Wed Dec  4 14:35:00 2002
--- Web.pm      Wed Dec  4 14:40:05 2002
***************
*** 1298,1304 ****

       foreach my $linktype (@linktypes) {

!         for my $luri ( split ( / /, $ARGSRef->{ $Ticket->Id . 
"-$linktype" } ) )
           {
               $luri =~ s/\s*$//;    # Strip trailing whitespace
               my ( $val, $msg ) = $Ticket->AddLink(
--- 1298,1305 ----

       foreach my $linktype (@linktypes) {

!         for my $ticketid ($Ticket->Id, 'bulk') {
!             for my $luri ( split ( / /, $ARGSRef->{ "$ticketid-$linktype" 
} ) )
               {
                   $luri =~ s/\s*$//;    # Strip trailing whitespace
                   my ( $val, $msg ) = $Ticket->AddLink(
***************
*** 1308,1314 ****
               push @results, $msg;
           }

!         for my $luri ( split ( / /, $ARGSRef->{ "$linktype-" . 
$Ticket->Id } ) )
           {
               my ( $val, $msg ) = $Ticket->AddLink(
                   Base => $luri,
--- 1309,1315 ----
                   push @results, $msg;
               }

!             for my $luri ( split ( / /, $ARGSRef->{ "$linktype-$ticketid" 
} ) )
               {
                   my ( $val, $msg ) = $Ticket->AddLink(
                       Base => $luri,
***************
*** 1318,1331 ****
               push @results, $msg;
           }
       }

       #Merge if we need to
!     if ( $ARGSRef->{ $Ticket->Id . "-MergeInto" } ) {
           my ( $val, $msg ) =
!           $Ticket->MergeInto( $ARGSRef->{ $Ticket->Id . "-MergeInto" } );
           push @results, $msg;
       }
!
       return (@results);
   }

--- 1319,1334 ----
                   push @results, $msg;
               }
           }
+     }

       #Merge if we need to
!     for my $ticketid ($Ticket->Id, 'bulk') {
!         if ( $ARGSRef->{ "$ticketid-MergeInto" } ) {
               my ( $val, $msg ) =
!               $Ticket->MergeInto( $ARGSRef->{ "$ticketid-MergeInto" } );
               push @results, $msg;
           }
!     }
       return (@results);
   }


*** Web.pm.orig Wed Dec  4 14:35:00 2002
--- Web.pm      Wed Dec  4 14:40:05 2002
***************
*** 1298,1331 ****

       foreach my $linktype (@linktypes) {

!         for my $luri ( split ( / /, $ARGSRef->{ $Ticket->Id . 
"-$linktype" } ) )
!         {
!             $luri =~ s/\s*$//;    # Strip trailing whitespace
!             my ( $val, $msg ) = $Ticket->AddLink(
!                 Target => $luri,
!                 Type   => $linktype
!             );
!             push @results, $msg;
           }

!         for my $luri ( split ( / /, $ARGSRef->{ "$linktype-" . 
$Ticket->Id } ) )
!         {
!             my ( $val, $msg ) = $Ticket->AddLink(
!                 Base => $luri,
!                 Type => $linktype
!             );
!
               push @results, $msg;
           }
       }
-
-     #Merge if we need to
-     if ( $ARGSRef->{ $Ticket->Id . "-MergeInto" } ) {
-         my ( $val, $msg ) =
-           $Ticket->MergeInto( $ARGSRef->{ $Ticket->Id . "-MergeInto" } );
-         push @results, $msg;
-     }
-
       return (@results);
   }

--- 1298,1334 ----

       foreach my $linktype (@linktypes) {

!         for my $ticketid ($Ticket->Id, 'bulk') {
!             for my $luri ( split ( / /, $ARGSRef->{ "$ticketid-$linktype" 
} ) )
!             {
!                 $luri =~ s/\s*$//;    # Strip trailing whitespace
!                 my ( $val, $msg ) = $Ticket->AddLink(
!                     Target => $luri,
!                     Type   => $linktype
!                 );
!                 push @results, $msg;
!             }
!
!             for my $luri ( split ( / /, $ARGSRef->{ "$linktype-$ticketid" 
} ) )
!             {
!                 my ( $val, $msg ) = $Ticket->AddLink(
!                     Base => $luri,
!                     Type => $linktype
!                 );
!
!                 push @results, $msg;
!             }
           }
+     }

!     #Merge if we need to
!     for my $ticketid ($Ticket->Id, 'bulk') {
!         if ( $ARGSRef->{ "$ticketid-MergeInto" } ) {
!             my ( $val, $msg ) =
!               $Ticket->MergeInto( $ARGSRef->{ "$ticketid-MergeInto" } );
               push @results, $msg;
           }
       }
       return (@results);
   }



=========================================================================
=     _/_/_/ _/_/_/ _/_/_/ _/_/_/ _/  _/ Brook Schofield                =
=    _/  _/ _/  _/ _/  _/ _/  _/ _/ _/   B.Schofield at mailbox.gu.edu.au  =
=   _/_/   _/_/_/ _/  _/ _/  _/ _/_/     Ph: +61 7 387 53779 - WCN 0.28 =
=  _/  _/ _/ _/  _/  _/ _/  _/ _/ _/     Directory Services Integration =
= _/_/_/ _/  _/ _/_/_/ _/_/_/ _/  _/     Griffith University QLD 4111   =
=========================================================================




More information about the Rt-devel mailing list