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

2015-01-19 Thread Daniel Schwager
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__


smime.p7s
Description: S/MIME cryptographic signature


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

2015-01-15 Thread Daniel Schwager
Hi,

we installed the RT-Extension-RepeatTicket (1) which create recurring tickets - 
looks fine (-:

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

The docu (2) said only
To help you find this initial ticket, which may have been resolved long
ago, a custom field is created on each ticket
in the recurrence with link called "Original Ticket."

In the code (3), I found an object
$ticket->Attributes->Named('RepeatTicketSettings');

which has a member 
$args{'repeat-enabled'}

telling me about the state.

I'm interesting in all enabled recurring tickets which will be able to create 
new childs by running bin/rt-repeat-ticket.

Is there a query or a 5-line-perl-code showing me this information

regards
Danny


(1) http://search.cpan.org/~alexmv/RT-Extension-RepeatTicket-1.00/
(2) http://cpansearch.perl.org/src/ALEXMV/RT-Extension-RepeatTicket-1.00/README
(3) 
http://cpansearch.perl.org/src/ALEXMV/RT-Extension-RepeatTicket-1.00/lib/RT/Extension/RepeatTicket.pm


smime.p7s
Description: S/MIME cryptographic signature