[freeside-commits] freeside/FS/FS/part_pkg flat.pm, 1.18, 1.19 base_rate.pm, 1.1, 1.2 prorate.pm, 1.12, 1.13 subscription.pm, 1.11, 1.12

Jeff Finucane,420,, jeff at wavetail.420.am
Mon Sep 17 23:32:53 PDT 2007


Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail:/tmp/cvs-serv27030/FS/FS/part_pkg

Modified Files:
	flat.pm base_rate.pm prorate.pm subscription.pm 
Log Message:
allow assignment of auto recharge values AND rollover

Index: prorate.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/prorate.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- prorate.pm	1 Aug 2007 22:24:50 -0000	1.12
+++ prorate.pm	18 Sep 2007 06:32:51 -0000	1.13
@@ -61,6 +61,10 @@
 			 'format' => \&FS::UI::bytecount::display_bytecount,
 			 'parse' => \&FS::UI::bytecount::parse_bytecount,
                        },
+    'usage_rollover' => { 'name' => 'Allow usage from previous period to roll '.
+			            'over into current period',
+			  'type' => 'checkbox',
+                        },
     #it would be better if this had to be turned on, its confusing
     'externalid' => { 'name'   => 'Optional External ID',
                       'default' => '',
@@ -70,7 +74,7 @@
                     'seconds', 'upbyte', 'downbytes', 'totalbytes',
                     'recharge_amount', 'recharge_seconds', 'recharge_upbytes',
                     'recharge_downbytes', 'recharge_totalbytes',
-                    'externalid', ],
+                    'usage_rollover', 'externalid', ],
   'freq' => 'm',
   'weight' => 20,
 );
@@ -83,8 +87,6 @@
   my $mend;
   my $mstart;
   
-  $self->reset_usage($cust_pkg);
-
   if ( $mday >= $cutoff_day ) {
     $mend =
       timelocal(0,0,0,$cutoff_day, $mon == 11 ? 0 : $mon+1, $year+($mon==11));

Index: flat.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/flat.pm,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- flat.pm	1 Aug 2007 22:24:50 -0000	1.18
+++ flat.pm	18 Sep 2007 06:32:50 -0000	1.19
@@ -63,12 +63,16 @@
                          'format' => \&FS::UI::bytecount::display_bytecount,
                          'parse' => \&FS::UI::bytecount::parse_bytecount,
                        },
+    'usage_rollover' => { 'name' => 'Allow usage from previous period to roll '.
+                                    ' over into current period',
+                          'type' => 'checkbox',
+                        },
   },
   'fieldorder' => [ 'setup_fee', 'recur_fee', 'unused_credit', 
                     'seconds', 'upbytes', 'downbytes', 'totalbytes',
                     'recharge_amount', 'recharge_seconds', 'recharge_upbytes',
                     'recharge_downbytes', 'recharge_totalbytes',
-                    'externalid' ],
+                    'usage_rollover', 'externalid' ],
   'weight' => 10,
 );
 
@@ -141,7 +145,11 @@
   my %values = map { $_, $self->option($_) } 
     grep { $self->option($_, 'hush') } 
     qw(seconds upbytes downbytes totalbytes);
-  $cust_pkg->set_usage(\%values);
+  if ($self->option('usage_rollover', 1)) {
+    $cust_pkg->recharge(\%values);
+  }else{
+    $cust_pkg->set_usage(\%values);
+  }
 }
 
 1;

Index: base_rate.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/base_rate.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- base_rate.pm	16 Feb 2007 19:46:04 -0000	1.1
+++ base_rate.pm	18 Sep 2007 06:32:50 -0000	1.2
@@ -43,7 +43,6 @@
 
 sub calc_recur {
   my($self, $cust_pkg) = @_;
-  $self->reset_usage($cust_pkg);
   $self->base_recur($cust_pkg);
 }
 
@@ -91,12 +90,4 @@
   0; #no, we're postpaid
 }
 
-sub reset_usage {
-  my($self, $cust_pkg) = @_;
-  my %values = map { $_, $self->option($_) } 
-    grep { $self->option($_, 'hush') } 
-    qw(seconds upbytes downbytes totalbytes);
-  $cust_pkg->set_usage(\%values);
-}
-
 1;

Index: subscription.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/subscription.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- subscription.pm	1 Aug 2007 22:24:50 -0000	1.11
+++ subscription.pm	18 Sep 2007 06:32:51 -0000	1.12
@@ -57,6 +57,10 @@
 			 'format' => \&FS::UI::bytecount::display_bytecount,
 			 'parse' => \&FS::UI::bytecount::parse_bytecount,
                        },
+    'usage_rollover' => { 'name' => 'Allow usage from previous period to roll '.
+			            'over into current period',
+			  'type' => 'checkbox',
+                        },
     #it would be better if this had to be turned on, its confusing
     'externalid' => { 'name'   => 'Optional External ID',
                       'default' => '',
@@ -71,6 +75,7 @@
                     'upbytes', 'downbytes', 'totalbytes',
                     'recharge_amount', 'recharge_seconds', 'recharge_upbytes',
                     'recharge_downbytes', 'recharge_totalbytes',
+                    'usage_rollover',
                    ],
   'freq' => 'm',
   'weight' => 30,



More information about the freeside-commits mailing list