X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill.pm;h=5052ed1308b7f8265a86bf1cb405f37f07ecab10;hb=4b695753d2456060e6a16808120cbb488a19c584;hp=95e705802b2bd40c858d378aebea2a7139b19e26;hpb=c14803e37f1bfdcff882ee5cb35a9b10a93a88c9;p=freeside.git diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 95e705802..5052ed130 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -888,6 +888,7 @@ sub hide { =item apply_payments_and_credits [ OPTION => VALUE ... ] Applies unapplied payments and credits to this invoice. +Payments with the no_auto_apply flag set will not be applied. A hash of optional arguments may be passed. Currently "manual" is supported. If true, a payment receipt is sent instead of a statement when @@ -914,7 +915,9 @@ sub apply_payments_and_credits { $self->select_for_update; #mutex - my @payments = grep { $_->unapplied > 0 } $self->cust_main->cust_pay; + my @payments = grep { $_->unapplied > 0 } + grep { !$_->no_auto_apply } + $self->cust_main->cust_pay; my @credits = grep { $_->credited > 0 } $self->cust_main->cust_credit; if ( $conf->exists('pkg-balances') ) { @@ -2822,20 +2825,26 @@ sub _items_total { my @items; my ($pr_total) = $self->previous; - my ($new_charges_desc, $new_charges_amount); + my ($previous_charges_desc, $new_charges_desc, $new_charges_amount); if ( $conf->exists('previous_balance-exclude_from_total') ) { + # can we do some caching on this stuff? it's going to change infrequently + # in production + $previous_charges_desc = $self->mt( + $conf->config('previous_balance-text') || 'Previous Balance' + ); + # then return separate lines for previous balance and total new charges if ( $pr_total ) { push @items, - { total_item => $self->mt('Previous Balance'), + { total_item => $previous_charges_desc, total_amount => sprintf('%.2f',$pr_total) }; } $new_charges_desc = $self->mt( - $conf->config('previous_balance-exclude_from_total') + $conf->config('previous_balance-text-total_new_charges') || 'Total New Charges' - ); # localize 'Total New Charges' or whatever's in the config + ); $new_charges_amount = $self->charged;