adding clarity

This commit is contained in:
JT Smith 2004-05-02 15:31:04 +00:00
parent b51e210af5
commit b6fce85c04

View file

@ -256,23 +256,26 @@ A boolean value to determine whether the method should return the groups directl
=cut =cut
sub getGroupsInGroup { sub getGroupsInGroup {
return undef unless $_[0]; my $groupId = shift;
my $groups = WebGUI::SQL->buildArrayRef("select groupId from groupGroupings where inGroup=$_[0]"); my $isRecursive = shift;
if ($_[1]) { my $loopCount = shift;
my $loopCount = $_[2]++ || 1; my $groups = WebGUI::SQL->buildArrayRef("select groupId from groupGroupings where inGroup=$groupId");
if ($loopCount > 99) { if ($isRecursive) {
WebGUI::ErrorHandler::fatalError("Endless recursive loop detected while determinating". $loopCount++;
" groups in group.\nRequested groupId: ".$_[0]."\nGroups in that group: ".join(",",@$groups)); if ($loopCount > 99) {
} WebGUI::ErrorHandler::fatalError("Endless recursive loop detected while determining".
my @groupsOfGroups = @$groups; " groups in group.\nRequested groupId: ".$groupId."\nGroups in that group: ".join(",",@$groups));
foreach my $group (@$groups) { }
my $gog = getGroupsInGroup($group,1,$loopCount); my @groupsOfGroups = @$groups;
push(@groupsOfGroups, @$gog); foreach my $group (@$groups) {
} my $gog = getGroupsInGroup($group,1,$loopCount);
return \@groupsOfGroups; push(@groupsOfGroups, @$gog);
} }
return $groups; return \@groupsOfGroups;
}
return $groups;
} }