From 71eb3c33da045ffdc963b5ad8111af8a8bef878d Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 6 Oct 2003 11:14:30 +0000 Subject: [PATCH 1/1] agent browse shows # of active accounts & links to appropriate account search --- httemplate/browse/svc_acct_pop.cgi | 52 +++++++++++++++++++++++--------------- httemplate/search/svc_acct.cgi | 13 +++++++++- 2 files changed, 44 insertions(+), 21 deletions(-) diff --git a/httemplate/browse/svc_acct_pop.cgi b/httemplate/browse/svc_acct_pop.cgi index 8d35cb56a..80168728c 100755 --- a/httemplate/browse/svc_acct_pop.cgi +++ b/httemplate/browse/svc_acct_pop.cgi @@ -1,4 +1,9 @@ +<% + my $accounts_sth = dbh->prepare("SELECT COUNT(*) FROM svc_acct + WHERE popnum = ? ") + or die dbh->errstr; +%> <%= header('Access Number Listing', menubar( 'Main Menu' => $p )) %> Points of Presence

Add new Access Number

@@ -10,6 +15,7 @@ Points of Presence

Area code Exchange Local + Accounts <% @@ -18,32 +24,38 @@ foreach my $svc_acct_pop ( sort { $a->state cmp $b->state || $a->city cmp $b->city || $a->ac <=> $b->ac || $a->exch <=> $b->exch || $a->loc <=> $b->loc } qsearch('svc_acct_pop',{}) ) { - my($hashref)=$svc_acct_pop->hashref; - print <popnum; + + $accounts_sth->execute($svc_acct_pop->popnum) or die $accounts_sth->errstr; + my $num_accounts = $accounts_sth->fetchrow_arrayref->[0]; + + my $svc_acct_link = $p. 'search/svc_acct.cgi?popnum='. $svc_acct_pop->popnum; + +%> - - $hashref->{popnum} - - $hashref->{city} - - $hashref->{state} - - $hashref->{ac} - - $hashref->{exch} - - $hashref->{loc} + + <%= $svc_acct_pop->popnum %> + + <%= $svc_acct_pop->city %> + + <%= $svc_acct_pop->state %> + + <%= $svc_acct_pop->ac %> + + <%= $svc_acct_pop->exch %> + + <%= $svc_acct_pop->loc %> + + <%= $num_accounts %> + active + -END +<% } %> -} - -print < -END -%> diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index e43f4f79b..0954bf652 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -48,12 +48,23 @@ if ( $query eq 'svcnum' ) { $sortby=\*uid_sort; $orderby = ( $unlinked ? 'AND' : 'WHERE' ). " ${tblname}uid IS NOT NULL ORDER BY ${tblname}uid"; +} elsif ( $query =~ /popnum=(\d+)/ ) { + my $popnum = $1; + $unlinked .= ( $unlinked ? 'AND' : 'WHERE' ). + " popnum = $popnum"; + $sortby=\*username_sort; + $orderby = "ORDER BY ${tblname}username"; } else { $sortby=\*uid_sort; @svc_acct = @{&usernamesearch}; } -if ( $query eq 'svcnum' || $query eq 'username' || $query eq 'uid' ) { + +if ( $query eq 'svcnum' + || $query eq 'username' + || $query eq 'uid' + || $query eq 'popnum' + ) { my $statement = "SELECT COUNT(*) FROM svc_acct $unlinked"; my $sth = dbh->prepare($statement) -- 2.11.0