[freeside-commits] freeside/FS/FS/part_pkg flat.pm, 1.13.2.13, 1.13.2.14 prepaid.pm, 1.3, 1.3.2.1

Ivan,,, ivan at wavetail.420.am
Fri May 29 20:14:37 PDT 2009


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

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	flat.pm prepaid.pm 
Log Message:
add ability for prepaid packages to have usage limits and cancel if they're hit, RT#4995

Index: prepaid.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/prepaid.pm,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -d -r1.3 -r1.3.2.1
--- prepaid.pm	22 Oct 2006 05:22:51 -0000	1.3
+++ prepaid.pm	30 May 2009 03:14:35 -0000	1.3.2.1
@@ -12,6 +12,11 @@
   'cancel'  => 'cancel',
 ;
 
+tie my %overlimit_action, 'Tie::IxHash',
+  'overlimit' => 'Default overlimit processing',
+  'cancel'    => 'Cancel',
+;
+
 %info = (
   'name' => 'Prepaid, flat rate',
   'fields' => {
@@ -25,8 +30,17 @@
                         'type' => 'select',
 			'select_options' => \%recur_action,
 	              },
+    %FS::part_pkg::flat::usage_fields,
+    'overlimit_action' => { 'name' => 'Action to take upon reaching a usage limit.',
+                            'type' => 'select',
+                            'select_options' => \%overlimit_action,
+	              },
+    #XXX if you set overlimit_action to 'cancel', should also have the ability
+    # to select a reason
   },
-  'fieldorder' => [ 'setup_fee', 'recur_fee', 'recur_action', ],
+  'fieldorder' => [ qw( setup_fee recur_fee recur_action ),
+                    @FS::part_pkg::flat::usage_fieldorder,
+                  ],
   'weight' => 25,
 );
 

Index: flat.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/flat.pm,v
retrieving revision 1.13.2.13
retrieving revision 1.13.2.14
diff -u -d -r1.13.2.13 -r1.13.2.14
--- flat.pm	24 Mar 2009 04:36:16 -0000	1.13.2.13
+++ flat.pm	30 May 2009 03:14:35 -0000	1.13.2.14
@@ -1,7 +1,10 @@
 package FS::part_pkg::flat;
 
 use strict;
-use vars qw(@ISA %info);
+use vars qw( @ISA %info
+             %usage_fields %usage_recharge_fields
+             @usage_fieldorder @usage_recharge_fieldorder
+           );
 use Tie::IxHash;
 #use FS::Record qw(qsearch);
 use FS::UI::bytecount;
@@ -14,29 +17,8 @@
   'preceding' => "Preceding (past)",
 ;
 
-%info = (
-  'name' => 'Flat rate (anniversary billing)',
-  'fields' => {
-    'setup_fee'     => { 'name' => 'Setup fee for this package',
-                         'default' => 0,
-                       },
-    'recur_fee'     => { 'name' => 'Recurring fee for this package',
-                         'default' => 0,
-                       },
-
-    #false laziness w/voip_cdr.pm
-    'recur_temporality' => { 'name' => 'Charge recurring fee for period',
-                             'type' => 'select',
-                             'select_options' => \%temporalities,
-                           },
+%usage_fields = (
 
-    'unused_credit' => { 'name' => 'Credit the customer for the unused portion'.
-                                   ' of service at cancellation',
-                         'type' => 'checkbox',
-                       },
-    'externalid' => { 'name'   => 'Optional External ID',
-                      'default' => '',
-                    },
     'seconds'       => { 'name' => 'Time limit for this package',
                          'default' => '',
                          'check' => sub { shift =~ /^\d*$/ },
@@ -59,6 +41,10 @@
                          'format' => \&FS::UI::bytecount::display_bytecount,
                          'parse' => \&FS::UI::bytecount::parse_bytecount,
                        },
+);
+
+%usage_recharge_fields = (
+
     'recharge_amount'       => { 'name' => 'Cost of recharge for this package',
                          'default' => '',
                          'check' => sub { shift =~ /^\d*(\.\d{2})?$/ },
@@ -93,13 +79,46 @@
                                     'package recharge',
                           'type' => 'checkbox',
                         },
+);
+
+ at usage_fieldorder = qw( seconds upbytes downbytes totalbytes );
+ at usage_recharge_fieldorder = qw(
+  recharge_amount recharge_seconds recharge_upbytes
+  recharge_downbytes recharge_totalbytes
+  usage_rollover recharge_reset
+);
+
+%info = (
+  'name' => 'Flat rate (anniversary billing)',
+  'shortname' => 'Anniversary',
+  'fields' => {
+    'setup_fee'     => { 'name' => 'Setup fee for this package',
+                         'default' => 0,
+                       },
+    'recur_fee'     => { 'name' => 'Recurring fee for this package',
+                         'default' => 0,
+                       },
+
+    #false laziness w/voip_cdr.pm
+    'recur_temporality' => { 'name' => 'Charge recurring fee for period',
+                             'type' => 'select',
+                             'select_options' => \%temporalities,
+                           },
+
+    %usage_fields,
+    %usage_recharge_fields,
+
+    'unused_credit' => { 'name' => 'Credit the customer for the unused portion'.
+                                   ' of service at cancellation',
+                         'type' => 'checkbox',
+                       },
+    'externalid' => { 'name'   => 'Optional External ID',
+                      'default' => '',
+                    },
   },
-  'fieldorder' => [qw( setup_fee recur_fee recur_temporality unused_credit
-                       seconds upbytes downbytes totalbytes
-                       recharge_amount recharge_seconds recharge_upbytes
-                       recharge_downbytes recharge_totalbytes
-                       usage_rollover recharge_reset externalid
-                    )
+  'fieldorder' => [ qw( setup_fee recur_fee recur_temporality unused_credit ),
+                    @usage_fieldorder, @usage_recharge_fieldorder,
+                    qw( externalid ),
                   ],
   'weight' => 10,
 );



More information about the freeside-commits mailing list