[freeside-commits] branch FREESIDE_3_BRANCH updated. 3f9be57a4e888ffc2affe517025553c6c2f90265

Ivan ivan at 420.am
Mon Mar 31 10:57:23 PDT 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  3f9be57a4e888ffc2affe517025553c6c2f90265 (commit)
      from  774e2090dfca61fd120c73c06bfd8e02e5e7f5e3 (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 3f9be57a4e888ffc2affe517025553c6c2f90265
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Mar 31 10:57:22 2014 -0700

    don't bill prepaid packages in freeside-daily, RT#26274

diff --git a/FS/FS/Cron/bill.pm b/FS/FS/Cron/bill.pm
index d046930..807d5cf 100644
--- a/FS/FS/Cron/bill.pm
+++ b/FS/FS/Cron/bill.pm
@@ -100,6 +100,7 @@ sub bill {
           'resetup'      => ( $opt{'s'} ? $opt{'s'} : 0 ),
           'not_pkgpart'  => $opt{'g'}, #$not_pkgpart,
           'one_recur'    => $opt{'o'},
+          'no_prepaid'   => 1,
       );
 
       if ( $opt{'m'} ) {
diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm
index a15c990..bdb4520 100644
--- a/FS/FS/cust_main/Billing.pm
+++ b/FS/FS/cust_main/Billing.pm
@@ -329,6 +329,10 @@ An array ref of specific packages (objects) to attempt billing, instead trying a
 
 A hashref of pkgparts to exclude from this billing run (can also be specified as a comma-separated scalar).
 
+=item no_prepaid
+
+Do not bill prepaid packages.  Used by freeside-daily.
+
 =item invoice_time
 
 Used in conjunction with the I<time> option, this option specifies the date of for the generated invoices.  Other calculations, such as whether or not to generate the invoice in the first place, are not affected.
@@ -442,21 +446,23 @@ sub bill {
 
     next if $options{'not_pkgpart'}->{$cust_pkg->pkgpart};
 
+    my $part_pkg = $cust_pkg->part_pkg;
+
+    next if $options{'no_prepaid'} && $part_pkg->is_prepaid;
+
     warn "  bill package ". $cust_pkg->pkgnum. "\n" if $DEBUG;
 
     #? to avoid use of uninitialized value errors... ?
     $cust_pkg->setfield('bill', '')
       unless defined($cust_pkg->bill);
  
-    #my $part_pkg = $cust_pkg->part_pkg;
-
     my $real_pkgpart = $cust_pkg->pkgpart;
     my %hash = $cust_pkg->hash;
 
     # we could implement this bit as FS::part_pkg::has_hidden, but we already
     # suffer from performance issues
     $options{has_hidden} = 0;
-    my @part_pkg = $cust_pkg->part_pkg->self_and_bill_linked;
+    my @part_pkg = $part_pkg->self_and_bill_linked;
     $options{has_hidden} = 1 if ($part_pkg[1] && $part_pkg[1]->hidden);
  
     # if this package was changed from another package,

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

Summary of changes:
 FS/FS/Cron/bill.pm         |    1 +
 FS/FS/cust_main/Billing.pm |   12 +++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)




More information about the freeside-commits mailing list