From: ivan Date: Thu, 19 Sep 2002 08:43:03 +0000 (+0000) Subject: package expiration X-Git-Tag: freeside_1_5_0pre1~236 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=0f5ad6c181cccbbdec6c48ea74e41d92ef5e3a26 package expiration --- diff --git a/FS/bin/freeside-daily b/FS/bin/freeside-daily index 142b0c73a..22bf2c963 100755 --- a/FS/bin/freeside-daily +++ b/FS/bin/freeside-daily @@ -28,15 +28,23 @@ my($time)= $opt_d ? str2time($opt_d) : $^T; my($cust_main,%saw); foreach $cust_main ( @cust_main ) { - my $error; + # $^T not $time because -d is for pre-printing invoices + foreach my $cust_pkg ( + grep { $_->expire && $_->expire >= $^T } $cust_main->ncancelled_pkgs + ) { + my $error = $cust_pkg->cancel; + warn "Error cancelling expired pkg ". $cust_pkg->pkgnum. " for custnum ". + $cust_main->custnum. ": $error" + if $error; + } - $error = $cust_main->bill( 'time' => $time ); + my $error = $cust_main->bill( 'time' => $time ); warn "Error billing, custnum ". $cust_main->custnum. ": $error" if $error; $cust_main->apply_payments; $cust_main->apply_credits; - $error=$cust_main->collect( 'invoice_time' => $time ); + $error = $cust_main->collect( 'invoice_time' => $time ); warn "Error collecting, custnum". $cust_main->custnum. ": $error" if $error; }