[freeside-commits] freeside/FS/FS svc_acct.pm, 1.268.2.11, 1.268.2.12

Ivan,,, ivan at wavetail.420.am
Tue Feb 2 18:16:57 PST 2010


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv9848

Modified Files:
      Tag: FREESIDE_1_9_BRANCH
	svc_acct.pm 
Log Message:
fix time limits getting double added if the service is provisioned before first billing

Index: svc_acct.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_acct.pm,v
retrieving revision 1.268.2.11
retrieving revision 1.268.2.12
diff -u -d -r1.268.2.11 -r1.268.2.12
--- svc_acct.pm	26 Jan 2010 10:05:10 -0000	1.268.2.11
+++ svc_acct.pm	3 Feb 2010 02:16:55 -0000	1.268.2.12
@@ -697,13 +697,16 @@
 }
 
 # 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 @@
 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);
 
 }
 



More information about the freeside-commits mailing list