require svc_acct-usage_threshold to be set explicitly, don't default to 80%
authorivan <ivan>
Sat, 30 May 2009 02:31:39 +0000 (02:31 +0000)
committerivan <ivan>
Sat, 30 May 2009 02:31:39 +0000 (02:31 +0000)
FS/FS/Conf.pm
FS/FS/svc_acct.pm

index cf7e49f..0664c14 100644 (file)
@@ -2014,7 +2014,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',
   },
 
index 1a42e65..e5be294 100644 (file)
@@ -539,12 +539,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');
       }
 
     }