Logic error in PendingMyApprovals (3.4.HEAD)?

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>

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
[snip]

Actually, I meant that $tickets is a subset of $group_tickets.

Also, there doesn’t appear to be any right checking going on. Why
show an approval if the user doesn’t have the right to edit the
ticket?

-Todd