X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fview%2Fsvc_acct.cgi;h=6ca9bf0711d4132411b70ba7e1a2e025c02fb3e1;hb=18c025613fa052cf4ba8d484f1296cc2a1719a24;hp=7cebdf8dad11d389740a7601a1388c9900ad31fe;hpb=b63544b9961e09bfc95908f867993f2c44139b42;p=freeside.git
diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi
index 7cebdf8da..6ca9bf071 100755
--- a/httemplate/view/svc_acct.cgi
+++ b/httemplate/view/svc_acct.cgi
@@ -1,37 +1,18 @@
+
<%
-#
-
-use strict;
-use vars qw( $conf $cgi $domain $query $svcnum $svc_acct $cust_svc $pkgnum
- $cust_pkg $custnum $part_svc $p $svc_acct_pop $password
- $mydomain $svc_domain );
-use CGI;
-use CGI::Carp qw( fatalsToBrowser );
-use FS::UID qw( cgisuidsetup );
-use FS::CGI qw( header popurl menubar ntable);
-use FS::Record qw( qsearchs fields );
-use FS::Conf;
-use FS::svc_acct;
-use FS::cust_svc;
-use FS::cust_pkg;
-use FS::part_svc;
-use FS::svc_acct_pop;
-use FS::raddb;
-
-$cgi = new CGI;
-&cgisuidsetup($cgi);
-
-$conf = new FS::Conf;
-
-($query) = $cgi->keywords;
+
+my $conf = new FS::Conf;
+
+my($query) = $cgi->keywords;
$query =~ /^(\d+)$/;
-$svcnum = $1;
-$svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum});
+my $svcnum = $1;
+my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum});
die "Unknown svcnum" unless $svc_acct;
#false laziness w/all svc_*.cgi
-$cust_svc = qsearchs( 'cust_svc' , { 'svcnum' => $svcnum } );
-$pkgnum = $cust_svc->getfield('pkgnum');
+my $cust_svc = qsearchs( 'cust_svc' , { 'svcnum' => $svcnum } );
+my $pkgnum = $cust_svc->getfield('pkgnum');
+my($cust_pkg, $custnum);
if ($pkgnum) {
$cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } );
$custnum = $cust_pkg->custnum;
@@ -41,63 +22,184 @@ if ($pkgnum) {
}
#eofalse
-$part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } );
+my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } );
die "Unknown svcpart" unless $part_svc;
+my $domain;
if ( $svc_acct->domsvc ) {
- $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } );
+ my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } );
die "Unknown domain" unless $svc_domain;
$domain = $svc_domain->domain;
} else {
- unless ( $mydomain = $conf->config('domain') ) {
- die "No legacy domain config file and no svc_domain.svcnum record ".
- "for svc_acct.domsvc: ". $cust_svc->domsvc;
- }
- $domain = $mydomain;
+ die "No svc_domain.svcnum record for svc_acct.domsvc: ". $cust_svc->domsvc;
}
-$p = popurl(2);
-print header('Account View', menubar(
+%>
+
+
+
+<%= header('Account View', menubar(
( ( $pkgnum || $custnum )
- ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum",
- "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
+ ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
)
: ( "Cancel this (unaudited) account" =>
- "${p}misc/cancel-unaudited.cgi?$svcnum" )
+ "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')" )
),
"Main menu" => $p,
-));
+)) %>
+
+<%
+
+#if ( $cust_pkg && $cust_pkg->part_pkg->plan eq 'sqlradacct_hour' ) {
+if ( $part_svc->part_export('sqlradius')
+ || $part_svc->part_export('sqlradius_withdomain')
+) {
+
+ my $last_bill;
+ my %plandata;
+ if ( $cust_pkg ) {
+ #false laziness w/httemplate/edit/part_pkg... this stuff doesn't really
+ #belong in plan data
+ %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); }
+ split("\n", $cust_pkg->part_pkg->plandata );
+
+ $last_bill = $cust_pkg->last_bill;
+ } else {
+ $last_bill = 0;
+ %plandata = ();
+ }
+
+ my $seconds = $svc_acct->seconds_since_sqlradacct( $last_bill, time );
+ my $hour = int($seconds/3600);
+ my $min = int( ($seconds%3600) / 60 );
+ my $sec = $seconds%60;
+
+ my $input = $svc_acct->attribute_since_sqlradacct(
+ $last_bill, time, 'AcctInputOctets'
+ ) / 1048576;
+ my $output = $svc_acct->attribute_since_sqlradacct(
+ $last_bill, time, 'AcctOutputOctets'
+ ) / 1048576;
+
+%>
+
+ RADIUS session information
+ <%= ntable('#cccccc',2) %>
+