--- register/prgsrc/register.cgi 2003/07/16 02:08:28 1.16 +++ register/prgsrc/register.cgi 2003/09/04 21:09:47 1.17 @@ -20,11 +20,11 @@ Boris Veytsman =head1 DATE -$Date: 2003/07/16 02:08:28 $ +$Date: 2003/09/04 21:09:47 $ =head1 REVISION -$Revision: 1.16 $ +$Revision: 1.17 $ =cut @@ -45,7 +45,7 @@ my ($SENDMAIL) = "mail"; my $TO = 'borisv@lk.net, igra@gorlovka.net, erudit@mail.od.ua'; my $FROM = 'borisv@lk.net'; -my $date='$Date: 2003/07/16 02:08:28 $'; +my $date='$Date: 2003/09/04 21:09:47 $'; $date =~ s/[^ ]* ([^ ]*) .*/$1/; @@ -323,7 +323,7 @@ sub ListClubs { my $sth; if ($args{'cid'}) { $sth = $args{'dbh'}->prepare(" -SELECT Child FROM ClubClub WHERE Parent=$args{'cid'}"); +SELECT Child, Status FROM ClubClub WHERE Parent=$args{'cid'}"); } else { $sth = $args{'dbh'}->prepare(" SELECT cid FROM ClubRegion WHERE rid=$args{'rid'}"); @@ -350,15 +350,23 @@ END END } my @clubs=(); - while (my ($club)=$sth->fetchrow_array) { + my %stat=(); + while (my ($club,$status)=$sth->fetchrow_array) { push @clubs,"cid=$club"; + if ($status) { + $stat{$club}=$status; + } } my $clause = join(' OR ', @clubs); $sth=$args{'dbh'}->prepare(" SELECT cid, Name FROM Clubs WHERE $clause ORDER BY Name"); $sth->execute; while (my ($cid,$Name)=$sth->fetchrow_array) { - $result .= li("$Name\n"); + my $res="$Name\n"; + if (exists $stat{$cid}) { + $res .= " ($stat{$cid})\n"; + } + $result .= li($res); } $result .= "\n"; } @@ -372,7 +380,7 @@ sub ListParents { my $sth; $sth = $args{'dbh'}->prepare(" -SELECT Parent FROM ClubClub WHERE Child=$args{'cid'}"); +SELECT Parent, Status FROM ClubClub WHERE Child=$args{'cid'}"); $sth->execute; @@ -388,15 +396,23 @@ SELECT Parent FROM ClubClub WHERE Child= END my @clubs=(); - while (my ($club)=$sth->fetchrow_array) { + my %stat=(); + while (my ($club,$status)=$sth->fetchrow_array) { push @clubs,"cid=$club"; + if ($status) { + $stat{$club}=$status; + } } my $clause = join(' OR ', @clubs); $sth=$args{'dbh'}->prepare(" SELECT cid, Name FROM Clubs WHERE $clause ORDER BY Name"); $sth->execute; while (my ($cid,$Name)=$sth->fetchrow_array) { - $result .= dt("$Name\n"); + my $res = "$Name\n"; + if (exists $stat{$cid}) { + $res .= " ($stat{$cid})\n"; + } + $result .= dt($res); } $result .= "\n"; }