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;
}
+ # 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 ) {