[rt-users] More script questions

Mathew Snyder theillien at yahoo.com
Sat May 5 05:46:28 EDT 2007


I've modified a script to print out, for each user that wants one, a list of all
the tickets he or she has worked on in the previous week.  The part that gathers
everything up is as follows:

foreach my $date (@searchDate) {
        while (my $ticket = $tix->Next) {
                my $env = $ticket->FirstCustomFieldValue('Environment');
                my $transactions = $ticket->Transactions;
                while (my $transaction  = $transactions->Next) {
                        my $creator     = $transaction->CreatorObj;
                        (my $checkDate  = $transaction->Created) =~ s/\s.*$//;
                        next unless ($checkDate eq $date);
                        next unless ($creator->Privileged);
                        next unless ($transaction->TimeTaken);
                        $tikNums{$creator->Name}{$env}{$ticket->id} +=
$transaction->TimeTaken;
                }
                $tikSubj{$ticket->id} = $ticket->Subject;
        }
}

As you can see, at the end I put the subject of the ticket in it's own hash so I
can access it later when I print out the report.  However, this doesn't always
happen.  I'm seeing some users get reports that will have the subject for most
of the tickets but some tickets won't have one.  I've stepped through the code
in the debugger and have looked at the hash.  The tickets I've found to be
missing subjects in the report do actually have subjects associated with them in
the ticket subject hash.

I can't figure out, though, why the subject would be skipped for some tickets
and not others but more importantly, why it is being skipped at all.  I thought
it might be a result of the formatting not providing enough room and causing the
subject to be left out due to size but that isn't the case.

I've attached a copy of my script for your perusal.

Mathew
-- 
Keep up with me and what I'm up to: http://theillien.blogspot.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ticket_list.pl
Type: application/x-perl
Size: 6723 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20070505/d1c765c0/attachment.bin>


More information about the rt-users mailing list