X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fbrowse%2Fsvc_acct_pop.cgi;h=501d3625a911a3b31dbe40a5424d217fe1062d2b;hb=5250c44bd7f282c7d782bf0e8349af12376929df;hp=e5a611763f92d3a7fc94c93874032a1ea2e28108;hpb=91387f8f489e561deaf1de052d80ef800a4970a3;p=freeside.git
diff --git a/httemplate/browse/svc_acct_pop.cgi b/httemplate/browse/svc_acct_pop.cgi
index e5a611763..501d3625a 100755
--- a/httemplate/browse/svc_acct_pop.cgi
+++ b/httemplate/browse/svc_acct_pop.cgi
@@ -1,67 +1,78 @@
-<%
-#
+<% include( 'elements/browse.html',
+ 'title' => 'Access Numbers',
+ 'html_init' => $html_init,
+ 'name_singular' => 'access number',
+ 'query' => $query,
+ 'count_query' => $count_query,
+ 'header' => [
+ '#',
+ 'City',
+ 'State',
+ 'Area code',
+ 'Exchange',
+ 'Local',
+ 'Accounts',
+ ],
+ 'fields' => [
+ 'popnum',
+ 'city',
+ 'state',
+ 'ac',
+ 'exch',
+ 'loc',
+ $num_accounts_sub,
+ ],
+ 'align' => 'rllrrrr',
+ 'links' => [ map { $svc_acct_pop_link } (1..6) ],
+ )
+%>
+<%init>
-use strict;
-use vars qw( $cgi $p $svc_acct_pop );
-use CGI;
-use CGI::Carp qw(fatalsToBrowser);
-use FS::UID qw(cgisuidsetup);
-use FS::Record qw(qsearch qsearchs);
-use FS::CGI qw(header menubar table popurl);
-use FS::svc_acct_pop;
+my $curuser = $FS::CurrentUser::CurrentUser;
-$cgi = new CGI;
+die "access denied"
+ unless $curuser->access_right('Dialup configuration')
+ || $curuser->access_right('Dialup global configuration');
-&cgisuidsetup($cgi);
+my $html_init = qq!
+ Add new Access Number
+
+!;
-$p = popurl(2);
+my $query = { 'select' => '*,
+ ( SELECT COUNT(*) FROM svc_acct
+ WHERE svc_acct.popnum = svc_acct_pop.popnum
+ ) AS num_accounts
+ ',
+ 'table' => 'svc_acct_pop',
+ #'hashref' => { 'disabled' => '' },
+ 'extra_sql' => 'ORDER BY state, city, ac, exch, loc',
+ };
-print $cgi->header( @FS::CGI::header ), header('POP Listing', menubar(
- 'Main Menu' => $p,
-)), "Points of Presence
", &table(), <
- |
- City |
- State |
- Area code |
- Exchange |
- Local |
-
-END
+my $count_query = "SELECT COUNT(*) FROM svc_acct_pop"; # WHERE DISABLED IS NULL OR DISABLED = ''";
-foreach $svc_acct_pop ( sort {
- #$a->getfield('popnum') <=> $b->getfield('popnum')
- $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 <
-
- $hashref->{popnum} |
-
- $hashref->{city} |
-
- $hashref->{state} |
-
- $hashref->{ac} |
-
- $hashref->{exch} |
-
- $hashref->{loc} |
-
-END
+my $svc_acct_pop_link = [ $p.'edit/svc_acct_pop.cgi?', 'popnum' ];
-}
+my $svc_acct_link = $p. 'search/svc_acct.cgi?popnum=';
-print <
- Add new POP |
-
-
-
-