diff options
author | ivan <ivan> | 2002-10-17 14:16:17 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-10-17 14:16:17 +0000 |
commit | acfb0f48c226a5cba64fbe391677391128a6cbf7 (patch) | |
tree | 9e7dbc2b6b7cca0560cd5ec7abbf31f5be801d23 /httemplate | |
parent | bc1639be3d9f32711b4740324c6de1f3bffb0124 (diff) |
radacct update: use sqlradius for datasrc, not plandata options (whew)
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/edit/part_pkg.cgi | 13 | ||||
-rwxr-xr-x | httemplate/view/svc_acct.cgi | 16 |
2 files changed, 5 insertions, 24 deletions
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 5fbcd0bd1..187578a35 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -356,7 +356,7 @@ tie my %plans, 'Tie::IxHash', }, 'sqlradacct_hour' => { - 'name' => 'Base charge plus charge per-hour from an external SQL radacct table', + 'name' => 'Base charge plus charge per-hour from an external sqlradius radacct table', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, @@ -364,15 +364,6 @@ tie my %plans, 'Tie::IxHash', 'recur_flat' => { 'name' => 'Base monthly charge for this package', 'default' => 0, }, - 'sql_datasrc' => { 'name' => 'DBI data source', - 'default' => 'DBI:mysql:host=radius.server.name;dbname=radius', - }, - 'sql_username' => { 'name' => 'Database username', - 'default' => 'radius', - }, - 'sql_password' => { 'name' => 'Database password', - 'default' => '', - }, 'recur_included_hours' => { 'name' => 'Hours included', 'default' => 0, }, @@ -382,7 +373,7 @@ tie my %plans, 'Tie::IxHash', }, 'fieldorder' => [ 'setup_fee', 'recur_flat', 'recur_included_hours', 'recur_hourly_charge' ], 'setup' => 'what.setup_fee.value', - 'recur' => '\'my $hours = $cust_pkg->seconds_since_sqlradacct($cust_pkg->last_bill, $sdate, \' + what.sql_datasrc + \', \' + what.sql_username + \', \' + what.sql_password + \' ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours;\'', + 'recur' => '\'my $hours = $cust_pkg->seconds_since_sqlradacct($cust_pkg->last_bill, $sdate ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours;\'', }, diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index e755f87d7..dd242b980 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -146,21 +146,11 @@ print '<TR><TD ALIGN="right">RADIUS groups</TD><TD BGCOLOR="#ffffff">'. print '</TABLE></TD></TR></TABLE><BR><BR>'; -if ( $cust_pkg && $cust_pkg->part_pkg->plan eq 'sqlradacct_hour' ) { - - #false laziness w/httemplate/edit/part_pkg... this stuff doesn't really - #belong in plan data - my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } - split("\n", $cust_pkg->part_pkg->plandata ); +#if ( $cust_pkg && $cust_pkg->part_pkg->plan eq 'sqlradacct_hour' ) { +if ( $cust_pkg && $part_svc->part_export('sqlradius') ) { my $last_bill = $cust_pkg->last_bill; - my $seconds = $svc_acct->seconds_since_sqlradacct( - $last_bill, - time, - $plandata{sql_datasrc}, - $plandata{sql_username}, - $plandata{sql_password}, - ); + my $seconds = $svc_acct->seconds_since_sqlradacct( $last_bill, time ); my $h = int($seconds/3600); my $m = int( ($seconds%3600) / 60 ); my $s = $seconds%60; |