X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_bill.pm;h=844d1b8672aaca136ff7ac501979db121f26f07e;hp=2c0b35388a912429a75c5fca71831ad545d4dadf;hb=262ad6a5821649093c104d59b33d838c12520d3e;hpb=d0285e367e820a18906a69bb7b4a1057e30701cc diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 2c0b35388..844d1b867 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -432,12 +432,16 @@ sub apply_payments_and_credits { my @open_lineitems = $self->open_cust_bill_pkg; my $max_pay_weight = - max( map { $_->cust_pkg->part_pkg->pay_weight || 0 } - @open_lineitems + max( map { $_->part_pkg->pay_weight || 0 } + grep { $_ } + map { $_->cust_pkg } + @open_lineitems ); my $max_credit_weight = - max( map { $_->cust_pkg->part_pkg->credit_weight || 0 } - @open_lineitems + max( map { $_->part_pkg->credit_weight || 0 } + grep { $_ } + map { $_->cust_pkg } + @open_lineitems ); #if both are the same... payments first? it has to be something