[rt-users] RT-Extension-RepeatTicket - find all tickets with "Recurrence" enabled?

Daniel Schwager Daniel.Schwager at dtnet.de
Mon Jan 19 19:04:37 EST 2015


Hi all,

> Is there a way to create a search-query to find all the enabled recurring tickets?

after investigating the original rt-repeat-ticket perl script, I "developed" my own list implementation (1).

best regards
  Danny


(1) rt-repeat-ticket

#!/opt/perl-5.18.4/bin/perl                                                                                                                                                                                                              
use strict;
use warnings;

BEGIN {
    use lib qw(/opt/rt4/local/lib /opt/rt4/lib);
    use RT;
    RT::LoadConfig;
    RT::Init;
}

use RT::Attributes;
use RT::Ticket;
use RT::User;

__PACKAGE__->run(@ARGV) unless caller;

sub run{

    my $attrs = RT::Attributes->new( RT->SystemUser );
    $attrs->Limit( FIELD => 'Name', VALUE => 'RepeatTicketSettings' );

    my $ticket =  RT::Ticket->new( RT->SystemUser );

    while ( my $attr = $attrs->Next ) {
        next unless $attr->Content->{'repeat-enabled'};
        next unless $attr->Content->{'repeat-type'};
        next unless $attr->ObjectType eq "RT::Ticket";

        if (!defined $ticket->Load($attr->ObjectId)) {
            $RT::Logger->error("Can't load ticket ". $attr->ObjectId);
            next;
        }

        print '#' . $attr->ObjectId . ' '  . $ticket->Subject
            . ' (' . $ticket->OwnerObj->FriendlyName . '): '
            . $attr->Content->{'repeat-type'} . "\n";
    }
    return;
}
1;

__END__
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2279 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20150120/8e6e35e8/attachment.bin>


More information about the rt-users mailing list