X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fview%2Fsvc_acct.cgi;h=be58e4e1d2194fc543b0bff1f361a40af1e9c7c3;hb=fdfdba16902b3967a9f6deb955e9c6885419bc79;hp=496dab366e4c7bbb59ff08bd93b3fd1e5e8fd337;hpb=87af741da0dd5f6a76bbb566b4d6c54cd5b15315;p=freeside.git
diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi
index 496dab366..be58e4e1d 100755
--- a/httemplate/view/svc_acct.cgi
+++ b/httemplate/view/svc_acct.cgi
@@ -2,7 +2,6 @@
<%
my $conf = new FS::Conf;
-my $mydomain = $conf->config('domain');
my($query) = $cgi->keywords;
$query =~ /^(\d+)$/;
@@ -32,26 +31,125 @@ if ( $svc_acct->domsvc ) {
die "Unknown domain" unless $svc_domain;
$domain = $svc_domain->domain;
} else {
- unless ( $mydomain ) {
- 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;
+}
+
+%>
+
+
-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;
+
+ if ( $seconds ) {
+ print "Online $hourh $minm $secs";
+ } else {
+ print 'Has not logged on';
+ }
+
+ if ( $cust_pkg ) {
+ print ' since last bill ('. time2str("%C", $last_bill). ') - '.
+ $plandata{recur_included_hours}. ' total hours in plan
';
+ } else {
+ print ' (no billing cycle available for unaudited account)
';
+ }
+
+ print 'Input: '. sprintf("%.3f", $input). ' megabytes
';
+ print 'Output: '. sprintf("%.3f", $output). ' megabytes
';
+
+ print '
';
+
+}
#print qq!
Send account information!;
+%>
+
+<%
+ my @part_svc = ();
+ if ( $pkgnum ) {
+ @part_svc = grep { $_->svcdb eq 'svc_acct'
+ && $_->svcpart != $part_svc->svcpart }
+ $cust_pkg->available_part_svc;
+ } else {
+ @part_svc = qsearch('part_svc', {
+ svcdb => 'svc_acct',
+ disabled => '',
+ svcpart => { op=>'!=', value=>$part_svc->svcpart },
+ } );
+ }
+ if ( @part_svc ) {
+%>
+
+
'. encode_entities($password). ''; } else { print "(hidden)"; } @@ -82,10 +180,12 @@ $password = ''; if ( $conf->exists('security_phrase') ) { my $sec_phrase = $svc_acct->sec_phrase; print '