[freeside-commits] branch FREESIDE_4_BRANCH updated. 63aca7680cca3df7f0b2e84d75fefd1912e009ec

Ivan ivan at 420.am
Thu Mar 9 12:53:29 PST 2017


The branch, FREESIDE_4_BRANCH has been updated
       via  63aca7680cca3df7f0b2e84d75fefd1912e009ec (commit)
      from  5eb48cca81177ae5336fd014808eefe5cc75c8f4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 63aca7680cca3df7f0b2e84d75fefd1912e009ec
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Mar 9 12:53:28 2017 -0800

    fix upgrade for cust_bill_pay_batch when a batched payment was deleted by legacy code in the past, RT#75089

diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm
index cf3e81e..19e084a 100644
--- a/FS/FS/Upgrade.pm
+++ b/FS/FS/Upgrade.pm
@@ -574,6 +574,7 @@ sub upgrade_schema_data {
     'pkg_referral' => [],
     'cust_bill_pkg_discount' => [],
     'cust_msg' => [],
+    'cust_bill_pay_batch' => [],
     #update records referencing removed things with their FKs
     'cust_pkg' => [],
   ;
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.

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Upgrade.pm             |    1 +
 FS/FS/cust_bill_pay_batch.pm |   19 +++++++++++++++++++
 2 files changed, 20 insertions(+)




More information about the freeside-commits mailing list