[freeside-commits] freeside/FS/FS/part_pkg voip_cdr.pm, 1.3.2.10, 1.3.2.11

Ivan,,, ivan at wavetail.420.am
Wed Sep 10 00:30:58 PDT 2008


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

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	voip_cdr.pm 
Log Message:
add upcoming/preceding option, RT#3851

Index: voip_cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/voip_cdr.pm,v
retrieving revision 1.3.2.10
retrieving revision 1.3.2.11
diff -u -d -r1.3.2.10 -r1.3.2.11
--- voip_cdr.pm	20 Jun 2008 03:36:36 -0000	1.3.2.10
+++ voip_cdr.pm	10 Sep 2008 07:30:56 -0000	1.3.2.11
@@ -27,6 +27,11 @@
 #                'Asterisk (or other?) CDR table',
 #;
 
+tie my %temporalities, 'Tie::IxHash',
+  'upcoming'  => "Upcoming (future)",
+  'preceding' => "Preceding (past)",
+;
+
 %info = (
   'name' => 'VoIP rating by plan of CDR records in an internal (or external) SQL table',
   'fields' => {
@@ -36,6 +41,13 @@
     'recur_flat'     => { 'name' => 'Base recurring fee for this package',
                           'default' => 0,
                         },
+
+    #probably useful for other usage-charging price plans
+    'recur_temporality' => { 'name' => 'Charge recurring fee for period',
+                             'type' => 'select',
+                             'select_options' => \%temporalities,
+                           },
+
     'unused_credit' => { 'name' => 'Credit the customer for the unused portion'.
                                    ' of service at cancellation',
                          'type' => 'checkbox',
@@ -109,7 +121,7 @@
 
   },
   'fieldorder' => [qw(
-                       setup_fee recur_flat unused_credit
+                       setup_fee recur_flat recur_temporality unused_credit
                        rating_method ratenum 
                        default_prefix
                        disable_src
@@ -129,7 +141,11 @@
 sub calc_recur {
   my($self, $cust_pkg, $sdate, $details, $param ) = @_;
 
-  my $last_bill = $cust_pkg->last_bill;
+  #my $last_bill = $cust_pkg->last_bill;
+  my $last_bill = $cust_pkg->get('last_bill'); #->last_bill falls back to setup
+
+  return 0
+    if $self->option('recur_temporality') eq 'preceding' && $last_bill == 0;
 
   my $ratenum = $cust_pkg->part_pkg->option('ratenum');
 



More information about the freeside-commits mailing list