[rt-users] Merging Tickets

Emmanuel Lacour elacour at easter-eggs.com
Mon Sep 26 03:47:03 EDT 2016


Le 26/09/2016 à 07:44, Thanos Constantopoulos a écrit :
> Odyssey
>
> Dear All
>
>  
>
> Is there a way to prevent ticket merging when the tickets are not in
> the same queue?
>
>  
>


you have to override the method RT::Ticket->MergeInto for this.

Here is an (untested) sample code to put in rt/local/lib/RT/Ticket_Local.pm:


package RT::Ticket;

use strict;
no warnings qw(redefine);

my $old_mergeinto = \&MergeInto;

*MergeInto = sub {
    my $self = shift;
    my $ticket_id = shift;

    my $MergeInto = RT::Ticket->new($self->CurrentUser);
    $MergeInto->Load($ticket_id);

    if ( $MergeInto->Id ) {
            if ( $self->Queue != $MergeInto->Queue ) {
                 return ( 0, $self->loc("Can't merge tickets from
different queues ([_1], [_2])", $self->QueueObj->Name,
$MergeInto->QueueObj->Name) );
            }
    }
   
    return $old_mergeinto->($self, @_);

};

1;



if you only take care of the web interface, youb should be able to block
the merge processing using the callback located in
share/html/Ticket/ModifyLinks.html, by looking at posted args, loading
target ticket and checking queues against $TicketObj->Queue. Then if
queues does not match, push a message in @$Results and delete the merge
from $ARGSRef.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20160926/1c6a2bc9/attachment.htm>


More information about the rt-users mailing list