diff options
author | jeff <jeff> | 2009-06-15 20:43:57 +0000 |
---|---|---|
committer | jeff <jeff> | 2009-06-15 20:43:57 +0000 |
commit | 4dc5a3df393ecc08e34f820c22340146c2f386c8 (patch) | |
tree | ef7fcce397c6a3830ab0a3ee327057249121b1d1 /FS | |
parent | 0cbb171da2cf3c7059612c0f2fbcf4a8bb80ab58 (diff) |
check for need for postal fee before charging the customer, not after
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/cust_main.pm | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 124cbccca..1bbf92d17 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2429,18 +2429,18 @@ sub bill { return ''; } - 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"; - } - if ( $postal_pkg && - ( scalar( grep { $_->recur && $_->recur > 0 } @cust_bill_pkg) || + if ( scalar( grep { $_->recur && $_->recur > 0 } @cust_bill_pkg) || !$conf->exists('postal_invoice-recurring_only') - ) ) { + + 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, |