X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=FS%2Fbin%2Ffreeside-bill;h=82b3321e13eb19aa2ab861aa1e173bce0ef37e28;hb=f5266a4d07d116efd732f433d0f4f3a47b143a7d;hp=3462fa149e63c3edc911fa63c5fa7d1249476c02;hpb=6ef34dda51afba96d8dc6c4dd72427c3d4003945;p=freeside.git diff --git a/FS/bin/freeside-bill b/FS/bin/freeside-bill index 3462fa149..82b3321e1 100755 --- a/FS/bin/freeside-bill +++ b/FS/bin/freeside-bill @@ -1,3 +1,5 @@ +#!/usr/bin/perl -w +# don't take any world-facing input #!/usr/bin/perl -Tw use strict; @@ -55,15 +57,19 @@ foreach $cust_main ( warn "Error billing, customer #" . $cust_main->getfield('custnum') . ":" . $error if $error; + if ($main::opt_p) { + $cust_main->apply_payments; + $error=$cust_main->apply_credits; + } + if ($main::opt_c) { $error=$cust_main->collect('invoice_time'=>$time, 'batch_card' => $main::opt_i ? 'no' : 'yes', ); - warn "Error collecting customer #" . $cust_main->getfield('custnum') . - ":" . $error if $error; - - #sleep 1; + warn "Error collecting from customer #" . $cust_main->gcustnum. ":$error" + if $error; + #sleep 1; } } @@ -89,7 +95,7 @@ freeside-bill - Command line (crontab, script) interface to customer billing. =head1 SYNOPSIS - freeside-bill [ -c [ -a ] [ -i ] ] [ -d 'date' ] user [ custnum custnum ... ] + freeside-bill [ -c [ -p ] [ -a ] [ -i ] ] [ -d 'date' ] user [ custnum custnum ... ] =head1 DESCRIPTION @@ -98,6 +104,9 @@ the bill and collect methods of a cust_main object. See L. -c: Turn on collecting (you probably want this). + -p: Apply unapplied payments and credits before collecting (you probably want + this too) + -a: Call collect even if there isn't a new invoice (probably a bad idea for daily use) @@ -114,7 +123,7 @@ customers. Otherwise, bills all customers. =head1 VERSION -$Id: freeside-bill,v 1.7 2001-08-21 09:34:13 ivan Exp $ +$Id: freeside-bill,v 1.9 2001-09-11 00:08:18 ivan Exp $ =head1 BUGS