suspend_bill package option to continue recurring billing while suspended and part_pk...
authorivan <ivan>
Mon, 18 Oct 2010 02:46:33 +0000 (02:46 +0000)
committerivan <ivan>
Mon, 18 Oct 2010 02:46:33 +0000 (02:46 +0000)
FS/FS/Conf.pm
FS/FS/cust_main/Billing.pm
FS/FS/part_pkg/flat.pm
httemplate/edit/part_pkg.cgi
httemplate/view/cust_main/packages/status.html

index b3e5477..55495e3 100644 (file)
@@ -3991,6 +3991,13 @@ and customer address. Include units.',
     'type'        => 'text',
   },
 
+  {
+    'key'         => 'part_pkg-default_suspend_bill',
+    'section'     => 'billing',
+    'description' => 'Default the "Continue recurring billing while suspended" flag to on for new package definitions.',
+    'type'        => 'checkbox',
+  },
+
   { key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
   { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
   { key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
index b588dc5..10734bf 100644 (file)
@@ -856,15 +856,14 @@ sub _make_lines {
   my $recur = 0;
   my $unitrecur = 0;
   my $sdate;
-  if (     ! $cust_pkg->get('susp')
-       and ! $cust_pkg->get('start_date')
-       and ( $part_pkg->getfield('freq') ne '0'
-             && ( $cust_pkg->getfield('bill') || 0 ) <= $time
-           )
-        || ( $part_pkg->plan eq 'voip_cdr'
-              && $part_pkg->option('bill_every_call')
-           )
-        || ( $options{cancel} )
+  if (     ! $cust_pkg->start_date
+       and ( ! $cust_pkg->susp || $part_pkg->option('suspend_bill') )
+       and
+            ( $part_pkg->freq ne '0' && ( $cust_pkg->bill || 0 ) <= $time )
+         || ( $part_pkg->plan eq 'voip_cdr'
+               && $part_pkg->option('bill_every_call')
+            )
+         || $options{cancel}
   ) {
 
     # XXX should this be a package event?  probably.  events are called
index c52f96e..ee54c09 100644 (file)
@@ -135,6 +135,9 @@ tie my %contract_years, 'Tie::IxHash', (
                                     'with the customer\'s other packages',
                           'type' => 'checkbox',
                         },
+    'suspend_bill' => { 'name' => 'Continue recurring billing while suspended',
+                        'type' => 'checkbox',
+                      },
     'unsuspend_adjust_bill' => 
                         { 'name' => 'Adjust next bill date forward when '.
                                     'unsuspending',
@@ -153,7 +156,7 @@ tie my %contract_years, 'Tie::IxHash', (
                         expire_months adjourn_months
                         contract_end_months
                         start_1st sync_bill_date
-                        unsuspend_adjust_bill
+                        suspend_bill unsuspend_adjust_bill
                       ),
                     @usage_fieldorder, @usage_recharge_fieldorder,
                     qw( externalid ),
index 79dfa6a..be8b0f6 100755 (executable)
@@ -419,11 +419,14 @@ my $new_callback = sub {
   my( $cgi, $object, $fields ) = @_;
 
   my $conf = new FS::Conf; 
+
   if ( $conf->exists('agent_defaultpkg') ) {
     #my @all_agent_types = map {$_->typenum} qsearch('agent_type',{});
     @agent_type = map {$_->typenum} qsearch('agent_type',{});
   }
 
+  $options{'suspend_bill'}=1 if $conf->exists('part_pkg-default_suspend_bill');
+
 };
 
 my $clone_callback = sub {
index 74e52ef..c05cd5a 100644 (file)
@@ -54,7 +54,9 @@
 
     <% pkg_status_row_changed( $cust_pkg, %opt, 'colspan'=>$colspan ) %>
     <% pkg_status_row_if( $cust_pkg, $last_bill_or_renewed, 'last_bill', %opt, curuser=>$curuser ) %>
-%   # pkg_status_row($cust_pkg, 'Next bill', 'bill', %opt)
+%   if ( $part_pkg->option('suspend_bill') ) {
+      <% pkg_status_row_if( $cust_pkg, 'Next&nbsp;bill', 'bill', %opt, curuser=>$curuser ) %>
+%   }
     <% pkg_status_row_if( $cust_pkg, 'Expires', 'expire', %opt, curuser=>$curuser ) %>
     <% pkg_status_row_if( $cust_pkg, 'Contract ends', 'contract_end', %opt ) %>