summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2010-08-24 20:09:51 +0000
committerivan <ivan>2010-08-24 20:09:51 +0000
commitca44d2a9e3faeb47ad8a9419dd535a2d1ba53a30 (patch)
tree40845d03babadbf6e165da1bda84b914c07127ce
parentced6be92d868addbed9ff93b39bbd6a1f634bcb7 (diff)
insurance against prepaid double-billing, RT#9689
-rw-r--r--FS/bin/freeside-prepaidd15
1 files changed, 12 insertions, 3 deletions
diff --git a/FS/bin/freeside-prepaidd b/FS/bin/freeside-prepaidd
index 86bfe8794..2d64221de 100644
--- a/FS/bin/freeside-prepaidd
+++ b/FS/bin/freeside-prepaidd
@@ -41,21 +41,30 @@ while (1) {
my $work_cust_pkg = $cust_pkg;
my $cust_main = $cust_pkg->cust_main;
+
+ #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
- or $cust_main->total_credited > 0
+ || $cust_main->total_credited > 0
)
{
+
#this needs a flag to say only do the prepaid packages...
# and only try em if the renewal price matches.. but this will do for now
my $b_error = $cust_main->bill;
if ( $b_error ) {
warn "Error billing customer #". $cust_main->custnum;
- next;
+ next;
}
$b_error = $cust_main->apply_payments_and_credits;
if ( $b_error ) {
warn "Error applying payments&credits, customer #". $cust_main->custnum;
- next;
+ next;
}
$work_cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $work_cust_pkg->pkgnum } );