[freeside-commits] branch master updated. 065e15ad1ae8da86fca4d0b64af03ee084e7cf03

Ivan ivan at 420.am
Fri Mar 10 10:14:04 PST 2017


The branch, master has been updated
       via  065e15ad1ae8da86fca4d0b64af03ee084e7cf03 (commit)
      from  2e7d4cbc5ce7bf9705bcb811315b94b0ee54288b (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 065e15ad1ae8da86fca4d0b64af03ee084e7cf03
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Mar 10 10:14:03 2017 -0800

    fix upgrade for dangling cust_event_fee (how?), RT#75113

diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm
index db99372..8a3e83c 100644
--- a/FS/FS/Upgrade.pm
+++ b/FS/FS/Upgrade.pm
@@ -569,6 +569,7 @@ sub upgrade_schema_data {
     'cust_bill_pkg_discount' => [],
     'cust_msg' => [],
     'cust_bill_pay_batch' => [],
+    'cust_event_fee' => [],
     #update records referencing removed things with their FKs
     'cust_pkg' => [],
   ;
diff --git a/FS/FS/cust_event_fee.pm b/FS/FS/cust_event_fee.pm
index 375a533..5db4039 100644
--- a/FS/FS/cust_event_fee.pm
+++ b/FS/FS/cust_event_fee.pm
@@ -1,8 +1,8 @@
 package FS::cust_event_fee;
+use base qw( FS::Record FS::FeeOrigin_Mixin );
 
 use strict;
-use base qw( FS::Record FS::FeeOrigin_Mixin );
-use FS::Record qw( qsearch qsearchs );
+use FS::Record qw( qsearch dbh );
 
 =head1 NAME
 
@@ -194,6 +194,24 @@ sub cust_pkg {
   }
 }
 
+=back
+
+=cut
+
+sub _upgrade_schema {
+  my ($class, %opts) = @_;
+
+  my $sql = '
+    DELETE FROM cust_event_Fee WHERE NOT EXISTS
+      ( SELECT 1 FROM cust_event WHERE cust_event.eventnum = cust_event_fee.eventnum )
+  ';
+
+  my $sth = dbh->prepare($sql) or die dbh->errstr;
+  $sth->execute or die $sth->errstr;
+  '';
+}
+
+
 =head1 BUGS
 
 =head1 SEE ALSO

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

Summary of changes:
 FS/FS/Upgrade.pm        |    1 +
 FS/FS/cust_event_fee.pm |   22 ++++++++++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list