summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2010-02-03 02:16:54 +0000
committerivan <ivan>2010-02-03 02:16:54 +0000
commit29249857577d3e866a0f01d414ee1b32fb861359 (patch)
treed218fe98f9601c635a749173467c66176592f290 /FS
parent75125d51297402390c1bbb489cf39b74611b1009 (diff)
fix time limits getting double added if the service is provisioned before first billing
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/svc_acct.pm27
1 files changed, 10 insertions, 17 deletions
diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm
index f965e8dff..45f0a412e 100644
--- a/FS/FS/svc_acct.pm
+++ b/FS/FS/svc_acct.pm
@@ -697,13 +697,16 @@ sub insert {
}
# set usage fields and thresholds if unset but set in a package def
+# AND the package already has a last bill date (otherwise they get double added)
sub preinsert_hook_first {
my $self = shift;
return '' unless $self->pkgnum;
my $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $self->pkgnum } );
- my $part_pkg = $cust_pkg->part_pkg if $cust_pkg;
+ return '' unless $cust_pkg && $cust_pkg->last_bill;
+
+ my $part_pkg = $cust_pkg->part_pkg;
return '' unless $part_pkg && $part_pkg->can('usage_valuehash');
my %values = $part_pkg->usage_valuehash;
@@ -1673,30 +1676,20 @@ for the password.
sub radius_password {
my $self = shift;
- my($pw_attrib, $password);
+ my $pw_attrib;
if ( $self->_password_encoding eq 'ldap' ) {
-
$pw_attrib = 'Password-With-Header';
- $password = $self->_password;
-
} elsif ( $self->_password_encoding eq 'crypt' ) {
-
$pw_attrib = 'Crypt-Password';
- $password = $self->_password;
-
} elsif ( $self->_password_encoding eq 'plain' ) {
-
- $pw_attrib = $radius_password; #Cleartext-Password? man rlm_pap
- $password = $self->_password;
-
+ $pw_attrib = $radius_password;
} else {
-
- $pw_attrib = length($password) <= 12 ? $radius_password : 'Crypt-Password';
- $password = $self->_password;
-
+ $pw_attrib = length($self->_password) <= 12
+ ? $radius_password
+ : 'Crypt-Password';
}
- ($pw_attrib, $password);
+ ($pw_attrib, $self->_password);
}