X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main.pm;h=c28991fff293f9f5696947eb0dae551544ee1e9e;hb=d8d9ab1e82463af03526f85c6c20b58881ddcfa4;hp=76cea831d7d9328b13f132ba361bdf4b05949926;hpb=935bdc06dc2ac4c39d7bf110b678bff98fc041a8;p=freeside.git diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 76cea831d..c28991fff 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -1950,10 +1950,12 @@ sub bill_and_collect { # cancel packages ### - #$^T not $options{time} because freeside-daily -d is for pre-printing invoices - foreach my $cust_pkg ( - grep { $_->expire && $_->expire <= $^T } $self->ncancelled_pkgs - ) { + #$options{actual_time} not $options{time} because freeside-daily -d is for + #pre-printing invoices + my @cancel_pkgs = grep { $_->expire && $_->expire <= $options{actual_time} } + $self->ncancelled_pkgs; + + foreach my $cust_pkg ( @cancel_pkgs ) { my $error = $cust_pkg->cancel; warn "Error cancelling expired pkg ". $cust_pkg->pkgnum. " for custnum ". $self->custnum. ": $error" @@ -1964,15 +1966,22 @@ sub bill_and_collect { # suspend packages ### - #$^T not $options{time} because freeside-daily -d is for pre-printing invoices - foreach my $cust_pkg ( - grep { ( $_->part_pkg->is_prepaid && $_->bill && $_->bill < $^T - || $_->adjourn && $_->adjourn <= $^T - ) - && ! $_->susp + #$options{actual_time} not $options{time} because freeside-daily -d is for + #pre-printing invoices + my @susp_pkgs = + grep { ! $_->susp + && ( ( $_->part_pkg->is_prepaid + && $_->bill + && $_->bill < $options{actual_time} + ) + || ( $_->adjourn + && $_->adjourn <= $options{actual_time} + ) + ) } - $self->ncancelled_pkgs - ) { + $self->ncancelled_pkgs; + + foreach my $cust_pkg ( @susp_pkgs ) { my $error = $cust_pkg->suspend; warn "Error suspending package ". $cust_pkg->pkgnum. " for custnum ". $self->custnum. ": $error"