[freeside-commits] freeside/FS/FS/part_export radiator.pm,1.2,1.3

Ivan,,, ivan at wavetail.420.am
Tue Nov 22 05:26:59 PST 2005


Update of /home/cvs/cvsroot/freeside/FS/FS/part_export
In directory wavetail:/tmp/cvs-serv25000

Modified Files:
	radiator.pm 
Log Message:
update radiator export to deal with prepaid and some other random stuff

Index: radiator.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/radiator.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- radiator.pm	8 Sep 2005 19:15:12 -0000	1.2
+++ radiator.pm	22 Nov 2005 13:26:57 -0000	1.3
@@ -74,11 +74,26 @@
         qw( framed_filter_id framed_mtu framed_netmask framed_protocol
             framed_routing login_host login_service login_tcp_port )
   );
-  $hash{timeleft} = $svc_acct->seconds
+  $hash{'timeleft'} = $svc_acct->seconds
     if $svc_acct->seconds =~ /^\d+$/;
-  $hash{staticaddress} = $svc_acct->slipip
+  $hash{'staticaddress'} = $svc_acct->slipip
     if $svc_acct->slipip =~ /^[\d\.]+$/; # and $self->slipip ne '0.0.0.0';
 
+  $hash{'servicename'} = ( $svc_acct->radius_groups )[0];
+
+  my $cust_pkg = $self->cust_svc->cust_pkg;
+  $hash{validto} = $cust_pkg->bill
+    if $cust_pkg && $cust_pkg->part_pkg->is_prepaid && $cust_pkg->bill;
+
+  #some other random stuff, should probably be attributes or virtual fields
+  #$hash{'state'} = 0; #only inserts
+  #$hash{'badlogins'} = 0; #only inserts
+  $hash{'maxlogins'} = 1;
+  $hash{'addeddate'} = $cust_pkg->setup
+    if $cust_pkg && $cust_pkg->setup;
+  $hash{'validfrom'} = $cust_pkg->last_bill || $cust_pkg->setup
+    if $cust_pkg &&  ( $cust_pkg->last_bill || $cust_pkg->setup );
+
   %hash;
 }
 
@@ -99,6 +114,8 @@
 sub radiator_insert { #subroutine, not method
   my $dbh = radiator_connect(shift, shift, shift);
   my %hash = @_;
+  $hash{'state'} = 0; #see "random stuff" above
+  $hash{'badlogins'} = 0; #see "random stuff" above
 
   my $sth = $dbh->prepare(
     "INSERT INTO $radusers ( ". join(', ', keys %hash ). ' ) '.



More information about the freeside-commits mailing list