X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fsvc_acct.pm;h=45f0a412e223c5bdcc04d4e239a95692e58bb120;hb=af5b5947a7bcb13a94a84bb2b20c80a2778e0f35;hp=ca33aa858f5448e8c5369aa373c0d7eef34c798e;hpb=9ad4f8407cc106ef5815e65bce2ee873cd0896c2;p=freeside.git diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index ca33aa858..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; @@ -1333,11 +1336,14 @@ is >0), one will be generated randomly. sub set_password { my( $self, $pass ) = ( shift, shift ); + warn "[$me] set_password (to $pass) called on $self: ". Dumper($self) + if $DEBUG; + my $failure = gettext('illegal_password'). " $passwordmin-$passwordmax ". FS::Msgcat::_gettext('illegal_password_characters'). ": ". $pass; - my ($encoding, $encryption); + my( $encoding, $encryption ) = ('', ''); if ( $self->_password_encoding ) { $encoding = $self->_password_encoding; @@ -1357,7 +1363,7 @@ sub set_password { $self->_password_encoding($encoding); } - if( $encoding eq 'legacy' ) { + if ( $encoding eq 'legacy' ) { # The legacy behavior from check(): # If the password is blank, randomize it and set encoding to 'plain'. @@ -1374,14 +1380,12 @@ sub set_password { $pass = $1.$3; $self->_password_encoding('crypt'); # Various disabled crypt passwords - } elsif ( $pass eq '*' or - $pass eq '!' or - $pass eq '!!' ) { + } elsif ( $pass eq '*' || $pass eq '!' || $pass eq '!!' ) { $self->_password_encoding('crypt'); } else { return $failure; } - } + } $self->_password($pass); return; @@ -1672,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); }