summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2009-05-30 02:31:38 +0000
committerivan <ivan>2009-05-30 02:31:38 +0000
commit3ae50113ba75f6e1feb56106ff94b1417d40fb5e (patch)
tree4298969b0a421f3ab467773e9b0ffe43042ba148
parent7d25a40e89bc44921bf814d2a9433a6b5e701e6c (diff)
require svc_acct-usage_threshold to be set explicitly, don't default to 80%
-rw-r--r--FS/FS/Conf.pm2
-rw-r--r--FS/FS/svc_acct.pm5
2 files changed, 4 insertions, 3 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index bcf7bbaee..df9d9066e 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -1946,7 +1946,7 @@ worry that config_items is freeside-specific and icky.
{
'key' => 'svc_acct-usage_threshold',
'section' => 'billing',
- 'description' => 'The threshold (expressed as percentage) of acct.seconds or acct.up|down|totalbytes at which a warning message is sent to a service holder. Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd. Defaults to 80.',
+ 'description' => 'The threshold (expressed as percentage) of acct.seconds or acct.up|down|totalbytes at which a warning message is sent to a service holder. Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd.',
'type' => 'text',
},
diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm
index 03678c570..af490d9d0 100644
--- a/FS/FS/svc_acct.pm
+++ b/FS/FS/svc_acct.pm
@@ -558,12 +558,13 @@ sub insert {
my %values = $part_pkg->usage_valuehash;
my $multiplier = $conf->exists('svc_acct-usage_threshold')
? 1 - $conf->config('svc_acct-usage_threshold')/100
- : 0.20;
+ : 0.20; #doesn't matter
foreach ( keys %values ) {
next if $self->getfield($_);
$self->setfield( $_, $values{$_} );
- $self->setfield( $_. '_threshold', int( $values{$_} * $multiplier ) );
+ $self->setfield( $_. '_threshold', int( $values{$_} * $multiplier ) )
+ if $conf->exists('svc_acct-usage_threshold');
}
}