%# A well adjusted person is one who makes the same mistake twice without
%# getting nervous.
% $m->abort;
<%INIT>
my $UserObj = RT::User->new($RT::SystemUser);
if ($name) {
$UserObj->Load($name);
}
else {
$UserObj->LoadByCol( ExternalAuthId => ($id || RT::User->no_to_id($no)) );
}
my $List = [];
my $clause = "SELECT Id FROM Tickets WHERE Type = 'approval' AND ( Owner = ";
$clause .= $UserObj->Id;
# now, get additional owners (people that delegates to us)
my $Groups = RT::Groups->new( $RT::SystemUser );
$Groups->Limit( FIELD => 'Domain', OPERATOR => '=', VALUE => 'Personal' );
$Groups->Limit(
FIELD => 'Description',
OPERATOR => '=',
VALUE => $UserObj->PrincipalId
);
while (my $Group = $Groups->Next) {
next if $Group->Disabled;
$clause .= " OR ( Owner = " . $Group->Instance
. " AND IssueStatement = " . $Group->Name . ")";
}
$clause .= ") AND ( Status = 'open'";
$clause .= ") ORDER BY Created DESC;";
my ($IDMap, %done);
my $tickets = $RT::Handle->dbh->selectcol_arrayref($clause);
my $count = @$tickets;
%INIT>
<%ARGS>
$no => ''
$id => ''
$name => ''
%ARGS>