[freeside-commits] branch FREESIDE_3_BRANCH updated. 707e65c434b44d81650917601e4c67ca2f4aec18

Ivan Kohler ivan at freeside.biz
Thu Jan 4 14:16:59 PST 2018


The branch, FREESIDE_3_BRANCH has been updated
       via  707e65c434b44d81650917601e4c67ca2f4aec18 (commit)
      from  5d8e5252b99bb7ba5c2b922266b9af4dac0fb4dc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 707e65c434b44d81650917601e4c67ca2f4aec18
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Jan 4 14:16:58 2018 -0800

    add "bill_only_pkg_dates" option to inbound voip billing, RT#79001

diff --git a/FS/FS/part_pkg/voip_inbound.pm b/FS/FS/part_pkg/voip_inbound.pm
index 9bf9efd88..6af6dc375 100644
--- a/FS/FS/part_pkg/voip_inbound.pm
+++ b/FS/FS/part_pkg/voip_inbound.pm
@@ -120,6 +120,10 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
                            'type' => 'checkbox',
                          },
 
+    'bill_only_pkg_dates' => { 'name' => 'Only bill CDRs with a date during the package billing period',
+                               'type' => 'checkbox',
+                             },
+
     #XXX also have option for an external db
 #    'cdr_location' => { 'name' => 'CDR database location'
 #                        'type' => 'select',
@@ -160,6 +164,7 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
                        use_duration
                        output_format usage_mandate summarize_usage usage_section
                        bill_every_call
+                       bill_only_pkg_dates
                      )
                   ],
   'weight' => 42,
@@ -239,12 +244,18 @@ sub calc_usage {
   ) {
     my $svc_phone = $cust_svc->svc_x;
 
-    my $cdr_search = $svc_phone->psearch_cdrs(
+    my %options = (
       'inbound'        => 1,
       'default_prefix' => $self->option('default_prefix'),
       'status'         => '', # unprocessed only
       'for_update'     => 1,
     );
+    if ( $self->option('bill_only_pkg_dates') ) {
+      $options{'begin'} = $last_bill;
+      $options{'end'}   = $$sdate;
+    }
+
+    my $cdr_search = $svc_phone->psearch_cdrs(%options);
     $cdr_search->limit(1000);
     $cdr_search->increment(0);
     while ( my $cdr = $cdr_search->fetch ) {

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/part_pkg/voip_inbound.pm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)




More information about the freeside-commits mailing list