From 37c309cc6f31f6038c75641c6c21648a92337eb3 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 18 Jun 2009 10:07:29 +0000 Subject: [PATCH] uuh, don't bomb out if there *isn't* a postal fee package --- FS/FS/cust_main.pm | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 1bbf92d17..960c57024 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2436,28 +2436,33 @@ sub bill { my $postal_pkg = $self->charge_postal_fee(); if ( $postal_pkg && !ref( $postal_pkg ) ) { + $dbh->rollback if $oldAutoCommit; return "can't charge postal invoice fee for customer ". $self->custnum. ": $postal_pkg"; - } - foreach my $part_pkg ( $postal_pkg->part_pkg->self_and_bill_linked ) { - my $error = - $self->_make_lines( 'part_pkg' => $part_pkg, - 'cust_pkg' => $postal_pkg, - 'precommit_hooks' => \@precommit_hooks, - 'line_items' => \@cust_bill_pkg, - 'setup' => \$total_setup, - 'recur' => \$total_recur, - 'tax_matrix' => \%taxlisthash, - 'time' => $time, - 'options' => \%options, - ); - if ($error) { - $dbh->rollback if $oldAutoCommit; - return $error; + } elsif ( $postal_pkg ) { + + foreach my $part_pkg ( $postal_pkg->part_pkg->self_and_bill_linked ) { + my $error = + $self->_make_lines( 'part_pkg' => $part_pkg, + 'cust_pkg' => $postal_pkg, + 'precommit_hooks' => \@precommit_hooks, + 'line_items' => \@cust_bill_pkg, + 'setup' => \$total_setup, + 'recur' => \$total_recur, + 'tax_matrix' => \%taxlisthash, + 'time' => $time, + 'options' => \%options, + ); + if ($error) { + $dbh->rollback if $oldAutoCommit; + return $error; + } } + } + } warn "having a look at the taxes we found...\n" if $DEBUG > 2; -- 2.11.0