+
+ #insurance: somehow winding up here without things properly applied...
+ my $a_error = $cust_main->apply_payments_and_credits;
+ if ( $a_error ) {
+ warn "Error applying payments&credits, customer #". $cust_main->custnum;
+ next;
+ }
+
+ if ( ( $cust_main->total_unapplied_payments > 0
+ || $cust_main->total_unapplied_credits > 0
+ )
+ && ! FS::Conf->new->exists('prepaid-never_renew')