X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main%2FBilling.pm;h=4821ce5555533760e41a16ac29e803a910b9044c;hb=5c1f29673647a123c6ccb0e999676f286ce0b9f6;hp=47a3dc2d4f19920484282de55ea14639f18bedef;hpb=3f15da8a0dd800432253294e623c6caaabc59fe3;p=freeside.git diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm index 47a3dc2d4..4821ce555 100644 --- a/FS/FS/cust_main/Billing.pm +++ b/FS/FS/cust_main/Billing.pm @@ -216,6 +216,9 @@ sub cancel_expired_pkgs { my @errors = (); + my @really_cancel_pkgs; + my @cancel_reasons; + CUST_PKG: foreach my $cust_pkg ( @cancel_pkgs ) { my $cpr = $cust_pkg->last_cust_pkg_reason('expire'); my $error; @@ -233,14 +236,22 @@ sub cancel_expired_pkgs { $error = '' if ref $error eq 'FS::cust_pkg'; } else { # just cancel it - $error = $cust_pkg->cancel($cpr ? ( 'reason' => $cpr->reasonnum, - 'reason_otaker' => $cpr->otaker, - 'time' => $time, - ) - : () - ); + + push @really_cancel_pkgs, $cust_pkg; + push @cancel_reasons, $cpr; + } - push @errors, 'pkgnum '.$cust_pkg->pkgnum.": $error" if $error; + } + + if (@really_cancel_pkgs) { + + my %cancel_opt = ( 'cust_pkg' => \@really_cancel_pkgs, + 'cust_pkg_reason' => \@cancel_reasons, + 'time' => $time, + ); + + push @errors, $self->cancel_pkgs(%cancel_opt); + } join(' / ', @errors); @@ -1172,6 +1183,7 @@ sub _make_lines { if ( $param{'override_quantity'} ) { $override_quantity = $param{'override_quantity'}; + $unitrecur = $recur / $override_quantity; } if ( $increment_next_bill ) {