Bulk Merge,Parent/Child,Refers Patch

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 ----

  • <&|/l&>Remove Cc
  • <&|/l&>Add AdminCc
  • <&|/l&>Remove AdminCc +
  • <&|/l&>Make date Starts <& /Elements/SelectDate, Name => "Starts_Date", ShowTime => 0, Default => '' &> +
  • <&|/l&>Make date Started <& /Elements/SelectDate, Name => "Started_Date", ShowTime => 0, Default => '' &> +
  • <&|/l&>Make date Told <& /Elements/SelectDate, Name => "Told_Date", ShowTime => 0, Default => '' &> +
  • <&|/l&>Make date Due <& /Elements/SelectDate, Name => "Due_Date", ShowTime => 0, Default => '' &> +
  • <&|/l&>Make date Resolved <& /Elements/SelectDate, Name => "Resolved_Date", ShowTime => 0, Default => '' &> *** 101,113 ****
  • <&|/l&>Make Status <& /Elements/SelectStatus, Name => "Status" &>
    • <&|/l&>Make date Starts <& /Elements/SelectDate, Name =>

    “Starts_Date”, ShowTime => 0, Default => ‘’ &>

    • <&|/l&>Make date Started <& /Elements/SelectDate, Name =>

    “Started_Date”, ShowTime => 0, Default => ‘’ &>

    • <&|/l&>Make date Told <& /Elements/SelectDate, Name =>

    “Told_Date”, ShowTime => 0, Default => ‘’ &>

    • <&|/l&>Make date Due <& /Elements/SelectDate, Name =>

    “Due_Date”, ShowTime => 0, Default => ‘’ &>

    • <&|/l&>Make date Resolved <& /Elements/SelectDate, Name =>

    “Resolved_Date”, ShowTime => 0, Default => ‘’ &>

    — 106,120 ----

  • <&|/l&>Make Status <& /Elements/SelectStatus, Name => "Status" &>
    • <&|/l&>Enter tickets or URIs to link tickets to. Seperate multiple

    entries with spaces.</&>

    • <&|/l&>Merge into

    <&|/l&>(only one ticket)</&>

    • <&|/l&>Depends on
    • <&|/l&>Depended on by
    • <&|/l&>Parents
    • <&|/l&>Children
    • <&|/l&>Refers to
    • <&|/l&>Referred to by
  • *** 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@mailbox.gu.edu.au =
    = // //
    / _/ _/ _/ _/ // Ph: +61 7 387 53779 - WCN 0.28 =
    = _/ _/ _/ _/ _/ _/ _/ _/ _/ / Directory Services Integration =
    = //
    / / / /// /// _/ _/ Griffith University QLD 4111 =

    This patch provides support for Bulk addition and removal of Links within
    the RT web interface.

    Based on the query from Rob Mitzel:
    http://lists.fsck.com/pipermail/rt-users/2002-April/007623.html

    The diffs (unified this time) are based on 2.1.53 - but should be easy to
    apply to 2.0.15 with little/no trouble.

    -Brook

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

    Bulk.html.diff (5.51 KB)

    Bulk.html.diff_no_delete (4.85 KB)

    Web.pm.diff (4.04 KB)