X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_bill_ApplicationCommon.pm;h=cadb8a796673873f7e83b5692e997c0e21a7ec8d;hp=322728fad41d16f995e76aaf84217ab204af021d;hb=aed8ec35ccb9cdeb7ea0cb6ff2946f9d83d582f6;hpb=71f6c7a310cc5482d36d1592a4500b5a3a47e90e diff --git a/FS/FS/cust_bill_ApplicationCommon.pm b/FS/FS/cust_bill_ApplicationCommon.pm index 322728fad..cadb8a796 100644 --- a/FS/FS/cust_bill_ApplicationCommon.pm +++ b/FS/FS/cust_bill_ApplicationCommon.pm @@ -418,10 +418,10 @@ sub apply_to_lineitems { foreach my $cust_svc ( $cust_pkg->cust_svc ) { my $svc_x = $cust_svc->svc_x; - my @part_export = grep { $_->can('export_insert_on_payment') } + my @part_export = grep { $_->can('_export_insert_on_payment') } $cust_svc->part_svc->part_export; - foreach my $part_export ( $cust_svc->part_svc->part_export ) { + foreach my $part_export ( @part_export ) { $error = $part_export->_export_insert_on_payment($svc_x); if ( $error ) { $dbh->rollback if $oldAutoCommit; @@ -435,6 +435,17 @@ sub apply_to_lineitems { } + # unset promised payment date if there is one + my $cust_bill = $self->cust_bill; + if ( $cust_bill->promised_date and $cust_bill->owed <= 0 ) { + $cust_bill->set('promised_date', ''); + my $error = $cust_bill->replace; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + } + #everything should always be applied to line items in full now... sanity check $applied = sprintf('%.2f', $applied); unless ( $applied == $self->amount ) {