From bd1336161b9c25b93001cb785193efde6f3ef0d2 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 16 Nov 2009 02:27:12 +0000 Subject: [PATCH] add disable_cron_billing config, RT#6407 --- FS/FS/Conf.pm | 6 ++++++ FS/FS/Cron/bill.pm | 6 ++++++ FS/bin/freeside-daily | 1 + 3 files changed, 13 insertions(+) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 84f06590d..5afa142e2 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -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 => "DEPRECATED", type => "text" }, { key => "apachemachine", section => "deprecated", description => "DEPRECATED", type => "text" }, diff --git a/FS/FS/Cron/bill.pm b/FS/FS/Cron/bill.pm index dbb6c66c2..27011c69f 100644 --- a/FS/FS/Cron/bill.pm +++ b/FS/FS/Cron/bill.pm @@ -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'}; diff --git a/FS/bin/freeside-daily b/FS/bin/freeside-daily index 04073d47e..1be98ac9e 100755 --- a/FS/bin/freeside-daily +++ b/FS/bin/freeside-daily @@ -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); -- 2.11.0