per-package option to adjust bill date on unsuspend, RT#8434
authormark <mark>
Tue, 12 Oct 2010 19:06:44 +0000 (19:06 +0000)
committermark <mark>
Tue, 12 Oct 2010 19:06:44 +0000 (19:06 +0000)
FS/FS/cust_pkg.pm
FS/FS/part_pkg/flat.pm

index 19c9730..82fdce1 100644 (file)
@@ -1011,10 +1011,16 @@ sub unsuspend {
 
   my $conf = new FS::Conf;
 
-  $hash{'bill'} = ( $hash{'bill'} || $hash{'setup'} ) + $inactive
-    if ( $opt{'adjust_next_bill'}
-         || $conf->exists('unsuspend-always_adjust_next_bill_date') )
-    && $inactive > 0 && ( $hash{'bill'} || $hash{'setup'} );
+  if ( $inactive > 0 &&
+        ( $hash{'bill'} || $hash{'setup'} ) &&
+        ( $opt{'adjust_next_bill'} ||
+          $conf->exists('unsuspend-always_adjust_next_bill_date') ||
+          $self->part_pkg->option('unsuspend_adjust_bill', 1) )
+     ) {
+    
+    $hash{'bill'} = ( $hash{'bill'} || $hash{'setup'} ) + $inactive;
+
+  }
 
   $hash{'susp'} = '';
   $hash{'adjourn'} = '' if $hash{'adjourn'} < time;
index be17fd8..3929cb9 100644 (file)
@@ -116,6 +116,11 @@ tie my %temporalities, 'Tie::IxHash',
     'start_1st'     => { 'name' => 'Auto-add a start date to the 1st, ignoring the current month.',
                          'type' => 'checkbox',
                        },
+    'unsuspend_adjust_bill' =>
+                       { 'name' => 'Adjust next bill date forward when '.
+                                   'unsuspending',
+                         'type' => 'checkbox',
+                       },
 
     %usage_fields,
     %usage_recharge_fields,
@@ -126,7 +131,7 @@ tie my %temporalities, 'Tie::IxHash',
   },
   'fieldorder' => [ qw( setup_fee recur_fee
                         recur_temporality unused_credit
-                        expire_months start_1st
+                        expire_months start_1st unsuspend_adjust_bill
                       ),
                     @usage_fieldorder, @usage_recharge_fieldorder,
                     qw( externalid ),