RT# 74877 flat pkg conf opt prorate_defer_change_bill
authorMitch Jackson <mitch@freeside.biz>
Fri, 8 Jun 2018 02:25:10 +0000 (21:25 -0500)
committerMitch Jackson <mitch@freeside.biz>
Fri, 8 Jun 2018 02:25:10 +0000 (21:25 -0500)
Enable this package flag to delay invoicing a customer
for a package change until their next normal bill date

FS/FS/cust_pkg.pm
FS/FS/part_pkg/flat.pm

index 07c5a47..d00f039 100644 (file)
@@ -2487,6 +2487,12 @@ sub change {
     $keep_dates = 0;
     $hash{'last_bill'} = '';
     $hash{'bill'} = '';
+
+    # Optionally, carry over the next bill date from the changed cust_pkg
+    # so an invoice isn't generated until the customer's usual billing date
+    if ( $self->part_pkg->option('prorate_defer_change_bill', 1) ) {
+      $hash{bill} = $self->bill;
+    }
   }
 
   if ( $keep_dates ) {
index 6fd9c7d..c06328b 100644 (file)
@@ -57,6 +57,12 @@ tie my %contract_years, 'Tie::IxHash', (
                                     'the customer\'s next bill date',
                           'type' => 'checkbox',
                         },
+    'prorate_defer_change_bill' => {
+                          'name' => 'When synchronizing, defer bill for '.
+                                    'package changes until the customer\'s '.
+                                    'next bill date',
+                          'type' => 'checkbox',
+                        },
     'prorate_round_day' => {
                           'name' => 'When synchronizing, round the prorated '.
                                     'period',
@@ -87,7 +93,8 @@ tie my %contract_years, 'Tie::IxHash', (
   },
   'fieldorder' => [ qw( recur_temporality 
                         start_1st
-                        sync_bill_date prorate_defer_bill prorate_round_day
+                        sync_bill_date prorate_defer_bill
+                        prorate_defer_change_bill prorate_round_day
                         suspend_bill unsuspend_adjust_bill
                         bill_recur_on_cancel
                         bill_suspend_as_cancel