[Rt-devel] Groups from User (Tickets.Creator)
Ralf Hack
ralf.hack at pipex.net
Tue Apr 27 17:47:20 EDT 2004
Hi,
I would like to write my own Limit function to select the displayed
tickets by Userdefined Group.
My structure is : Group A (an SLA based lot of companies) contains a
set of groups (one company per group). Within each Company-Group we have
one or more Company-contacts (Users). Ultimately, I would like to see
all tickets raised for Company/Group X on behalf of any of it's contacts
(ticket creator).
Is this at all possible, any pitfalls I should avoid ?
My CLI test so far worked for me, see the following program scrap:
my $a=RT::Group->new(RT::SystemUser);
$a->LoadUserDefinedGroup('A');
my $b=RT::GroupMembers->new(RT::SystemUser);
$b->Limit(
FIELD=>'GroupId',
VALUE=>$a->Id,
OPERATOR=>'=');
my $mems=RT::GroupMembers->new(RT::SystemUser);
$mems->DEBUG(1);
my $u=RT::User->new(RT::SystemUser);
my $n=1;
while (my $t = $b->Next) {
printf ("[%d] %s : %s\n", $n, $t->GroupId,$t->MemberId);
$mems->Limit (
FIELD=>'GroupId',
VALUE=>$t->MemberId,
OPERATOR=>'=');
while (my $m = $mems->Next) {
$u->Load($m->MemberId);
printf ("\t %s : %s contact: %s\n",
$m->MemberId,$m->id,$u->Name);
}
$n++;
}
More information about the Rt-devel
mailing list