diff options
author | Ivan Kohler <ivan@freeside.biz> | 2017-03-09 12:53:27 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2017-03-09 12:53:27 -0800 |
commit | 4266969f2c69f6fc07672f118b86716f52a95b86 (patch) | |
tree | 36068bd5ddb2295dd9608f36831a3232a6f0e6bc /FS/FS/cust_bill_pay_batch.pm | |
parent | 31e2411af8f9b34986942a6264e8229d9f60b923 (diff) |
fix upgrade for cust_bill_pay_batch when a batched payment was deleted by legacy code in the past, RT#75089
Diffstat (limited to 'FS/FS/cust_bill_pay_batch.pm')
-rw-r--r-- | FS/FS/cust_bill_pay_batch.pm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/FS/FS/cust_bill_pay_batch.pm b/FS/FS/cust_bill_pay_batch.pm index 8a8bef3..a9d07d3 100644 --- a/FS/FS/cust_bill_pay_batch.pm +++ b/FS/FS/cust_bill_pay_batch.pm @@ -2,6 +2,7 @@ package FS::cust_bill_pay_batch; use base qw( FS::Record ); use strict; +use FS::Record qw( dbh ); =head1 NAME @@ -103,6 +104,24 @@ sub check { =back +=cut + + +sub _upgrade_schema { + my ($class, %opts) = @_; + + my $sql = ' + DELETE FROM cust_bill_pay_batch WHERE NOT EXISTS + ( SELECT 1 FROM cust_pay_batch WHERE cust_pay_batch.paybatchnum = cust_bill_pay_batch.paybatchnum ) + '; + + my $sth = dbh->prepare($sql) or die dbh->errstr; + $sth->execute or die $sth->errstr; + ''; + +} + + =head1 BUGS Just hangs there. |