[freeside-commits] branch master updated. 717ed956e64cfc10f1e78e67b6c82dfcf212a18d

Ivan ivan at 420.am
Sat Feb 18 14:21:04 PST 2017


The branch, master has been updated
       via  717ed956e64cfc10f1e78e67b6c82dfcf212a18d (commit)
      from  d500b4af779a13e2fc862637fe67fe9394d5f286 (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 717ed956e64cfc10f1e78e67b6c82dfcf212a18d
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sat Feb 18 14:21:03 2017 -0800

    fix 4.x upgrades when an invoice with a discount was deleted instead of voided, RT#74611

diff --git a/FS/FS/cust_bill_pkg_discount.pm b/FS/FS/cust_bill_pkg_discount.pm
index 616657a..2a638a9 100644
--- a/FS/FS/cust_bill_pkg_discount.pm
+++ b/FS/FS/cust_bill_pkg_discount.pm
@@ -2,6 +2,7 @@ package FS::cust_bill_pkg_discount;
 use base qw( FS::cust_main_Mixin FS::Record );
 
 use strict;
+use FS::Record qw( dbh );
 
 =head1 NAME
 
@@ -185,6 +186,19 @@ sub description {
   return $desc;
 }
 
+sub _upgrade_schema {
+  my ($class, %opts) = @_;
+
+  my $sql = '
+    DELETE FROM cust_bill_pkg_discount WHERE NOT EXISTS
+      ( SELECT 1 FROM cust_bill_pkg WHERE cust_bill_pkg.billpkgnum = cust_bill_pkg_discount.billpkgnum )
+  ';
+
+  my $sth = dbh->prepare($sql) or die dbh->errstr;
+  $sth->execute or die $sth->errstr;
+  '';
+}
+
 =back
 
 =head1 BUGS

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

Summary of changes:
 FS/FS/cust_bill_pkg_discount.pm |   14 ++++++++++++++
 1 file changed, 14 insertions(+)




More information about the freeside-commits mailing list