From: ivan Date: Tue, 23 Dec 2003 00:41:15 +0000 (+0000) Subject: allow_negative_charges config option X-Git-Tag: NET_WHOIS_RAW_0_31~217 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=3c0d5d77527f46e59c68fb6f92de2391e779f07b allow_negative_charges config option --- diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index d911480df..b391fe44b 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1144,6 +1144,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 8695ae09c..3e40cc127 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -1201,15 +1201,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, @@ -1327,7 +1327,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