From: ivan Date: Tue, 23 Dec 2003 00:41:34 +0000 (+0000) Subject: allow_negative_charges config option X-Git-Tag: freeside_1_4_2beta1~336 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=44a5b8ae93bac552a5098522f7b73cb82b7b7e30;p=freeside.git allow_negative_charges config option --- diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index ac638f875..858dbbb9a 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1151,6 +1151,13 @@ httemplate/docs/config.html ], }, + { + 'key' => 'allow_negative_charges', + 'section' => 'billing', + 'description' => 'Allow negative charges. Normally not used unless importing data from a legacy system that requires this.', + 'type' => 'checkbox', + }, + ); 1; diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 57fe3b851..417937a24 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -1183,15 +1183,15 @@ sub bill { } $setup = sprintf( "%.2f", $setup ); $recur = sprintf( "%.2f", $recur ); - if ( $setup < 0 ) { + if ( $setup < 0 && ! $conf->exists('allow_negative_charges') ) { $dbh->rollback if $oldAutoCommit; return "negative setup $setup for pkgnum ". $cust_pkg->pkgnum; } - if ( $recur < 0 ) { + if ( $recur < 0 && ! $conf->exists('allow_negative_charges') ) { $dbh->rollback if $oldAutoCommit; return "negative recur $recur for pkgnum ". $cust_pkg->pkgnum; } - if ( $setup > 0 || $recur > 0 ) { + if ( $setup != 0 || $recur != 0 ) { my $cust_bill_pkg = new FS::cust_bill_pkg ({ 'pkgnum' => $cust_pkg->pkgnum, 'setup' => $setup, @@ -1308,7 +1308,7 @@ sub bill { } #unless $self->tax =~ /Y/i || $self->payby eq 'COMP' - } #if $setup > 0 || $recur > 0 + } #if $setup != 0 || $recur != 0 } #if $cust_pkg_mod_flag