summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2005-11-28 16:34:34 +0000
committerivan <ivan>2005-11-28 16:34:34 +0000
commit470a8626c0822e22a0b845b7c8ea1f09865db8a4 (patch)
tree8fd7436443119f8658cdae6b13baa3841437d7a9
parentf8057cbccbb028ad33891e8c735cb4f40cf54b2d (diff)
update cust_svc::seconds_since_sqlradacct to deal with any usage-capable export
-rw-r--r--FS/FS/cust_svc.pm15
1 files changed, 3 insertions, 12 deletions
diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm
index ecb3e725a..930e67375 100644
--- a/FS/FS/cust_svc.pm
+++ b/FS/FS/cust_svc.pm
@@ -492,10 +492,8 @@ sub attribute_since_sqlradacct {
my $svc_x = $self->svc_x;
- my @part_export = $self->part_svc->part_export('sqlradius');
- push @part_export, $self->part_svc->part_export('sqlradius_withdomain');
- die "no sqlradius or sqlradius_withdomain export configured for this".
- "service type"
+ my @part_export = $self->part_svc->part_export_usage;
+ die "no usage-capable export configured for this service type"
unless @part_export;
#or return undef;
@@ -521,14 +519,7 @@ sub attribute_since_sqlradacct {
$str2time = 'extract(epoch from ';
}
- my $username;
- if ( $part_export->exporttype eq 'sqlradius' ) {
- $username = $svc_x->username;
- } elsif ( $part_export->exporttype eq 'sqlradius_withdomain' ) {
- $username = $svc_x->email;
- } else {
- die 'unknown exporttype '. $part_export->exporttype;
- }
+ my $username = $part_export->export_username($svc_x);
my $sth = $dbh->prepare("SELECT SUM($attrib)
FROM radacct