add disable_cron_billing config, RT#6407
authorivan <ivan>
Mon, 16 Nov 2009 02:27:12 +0000 (02:27 +0000)
committerivan <ivan>
Mon, 16 Nov 2009 02:27:12 +0000 (02:27 +0000)
FS/FS/Conf.pm
FS/FS/Cron/bill.pm
FS/bin/freeside-daily

index 84f0659..5afa142 100644 (file)
@@ -3248,6 +3248,12 @@ worry that config_items is freeside-specific and icky.
     'type'        => 'select-pkg_class',
   },
 
+  {
+    'key'         => 'disable_cron_billing',
+    'section'     => 'billing',
+    'description' => 'Disable billing and collection from being run by freeside-daily and freeside-monthly, while still allowing other actions to run, such as notifications and backup.',
+    'type'        => 'checkbox',
+  },
 
   { key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
   { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
index dbb6c66..27011c6 100644 (file)
@@ -34,6 +34,12 @@ sub bill {
   $FS::cust_main::DEBUG = $debug;
   #$FS::cust_event::DEBUG = $opt{'l'} if $opt{'l'};
 
+  my $conf = new FS::Conf;
+  if ( $conf->exists('disable_cron_billing') ) {
+    warn "disable_cron_billing set, skipping billing\n" if $debug;
+    return;
+  }
+
   #we're at now now (and later).
   $opt{'time'} = $opt{'d'} ? str2time($opt{'d'}) : $^T;
   $opt{'time'} += $opt{'y'} * 86400 if $opt{'y'};
index 04073d4..1be98ac 100755 (executable)
@@ -12,6 +12,7 @@ getopts("p:a:d:vl:sy:nmrkg:", \%opt);
 my $user = shift or die &usage;
 adminsuidsetup $user;
 
+#you can skip this by setting the disable_cron_billing config
 use FS::Cron::bill qw(bill);
 bill(%opt);