[Rt-devel] Logic error in PendingMyApprovals (3.4.HEAD) ?

Todd Chapman todd at chaka.net
Fri Sep 16 13:53:05 EDT 2005


Is there a logic error in html/Approvals/Elements/PendingMyApproval ?

Why are two ticket collections created? No special Limits are placed
on $group_tickets, so shouldn't the collection end up being a
subset of $tickets?

-Todd

<%init>
my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
$tickets->LimitOwner( VALUE => $session{'CurrentUser'}->Id );

# also consider AdminCcs as potential approvers.
my $group_tickets = RT::Tickets->new( $session{'CurrentUser'} );

my $created_before = RT::Date->new( $session{'CurrentUser'} );
my $created_after = RT::Date->new( $session{'CurrentUser'} );

$RT::Logger->debug("Getting approval tickets...");
foreach ($tickets, $group_tickets) {
    $_->Limit( FIELD      => 'Type', VALUE => 'approval' );

    if ( $ARGS{'ShowResolved'} ) {
        $_->LimitStatus( VALUE => 'resolved' );
    }
    if ( $ARGS{'ShowRejected'} ) {
        $_->LimitStatus( VALUE => 'rejected' );
    }
    if ( $ARGS{'ShowPending'} || ( !$ARGS{'ShowRejected'} && !$ARGS{'Resolved'} ) ) {
        $_->LimitStatus( VALUE => 'open' );
        $_->LimitStatus( VALUE => 'new' );
        $_->LimitStatus( VALUE => 'stalled' );
    }

    if ( $ARGS{'CreatedBefore'} ) {
        $created_before->Set( Format => 'unknown', Value => $ARGS{'CreatedBefore'} );
        $_->LimitCreated( OPERATOR => "<=", VALUE => $created_before->ISO );
    }
    if ( $ARGS{'CreatedAfter'} ) {
        $created_after->Set( Format => 'unknown', Value => $ARGS{'CreatedAfter'} );
        $_->LimitCreated( OPERATOR => ">=", VALUE => $created_after->ISO );
    }
}
$RT::Logger->debug("Getting approval tickets...done");

</%init>



More information about the Rt-devel mailing list