[freeside-commits] freeside/FS/FS/part_pkg voip_cdr.pm,1.26,1.27

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


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

Modified Files:
	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.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- voip_cdr.pm	9 Sep 2008 02:35:58 -0000	1.26
+++ voip_cdr.pm	10 Sep 2008 07:30:45 -0000	1.27
@@ -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',
   'shortname' => 'VoIP/telco CDR rating (standard)',
@@ -37,6 +42,13 @@
     'recur_fee'     => { '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',
@@ -130,7 +142,7 @@
 
   },
   'fieldorder' => [qw(
-                       setup_fee recur_fee unused_credit
+                       setup_fee recur_fee recur_temporality unused_credit
                        rating_method ratenum 
                        default_prefix
                        disable_src
@@ -153,7 +165,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