[rt-users] Transactions

Mathew Snyder theillien at yahoo.com
Sun Jan 14 02:27:53 EST 2007


I'm writing a script which will make use of the RT API to access the database,
iterate through each transaction created during a period of time, determine if
the creator was a particular user and if so, add the TimeTaken to a hash.  I can
see that Transaction.pm contains these objects.  What I don't know is how to
access them.

I'm starting out with this:
<snip>
my @usrID;

my $users = new RT::Users(RT::SystemUser);
$users->LimitToPrivileged;

while ( my $user = $users->Next ) {
        next if $user->Name eq 'root';
        push @usrID, $user->id;
}

foreach my $id (@usrID) {
        print $id . "\n";
}

my $trnsObj = new RT::Transaction(RT::SystemUser);
$trnsObj->Creator;
while ( my $trans = $trnsObj->Next) {
        print $trans->id;
}
</snip>

This doesn't work though as there is no 'Next' method in Transaction.  How would
I do this?  I guess what I need is a method that will gather up all of the
transactions by a given user.

If someone else has created a sort to timesheet script similar to what I'm
trying to do I'd be appreciative if I could look at it as an example.  Any other
help will also be appreciated.

Mathew



More information about the rt-users mailing list