[freeside-commits] branch FREESIDE_4_BRANCH updated. dbc1003640a2f9593c1465ec66bf9be3645b834b

Ivan ivan at 420.am
Wed Jan 25 11:26:48 PST 2017


The branch, FREESIDE_4_BRANCH has been updated
       via  dbc1003640a2f9593c1465ec66bf9be3645b834b (commit)
      from  daed831fd026377530b224ef0d7ed9653a8eb763 (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 dbc1003640a2f9593c1465ec66bf9be3645b834b
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Jan 25 11:26:47 2017 -0800

    fix encryption upgrades when a payment is refunded, then deleted.  RT#74270, RT#73085

diff --git a/FS/FS/cust_refund.pm b/FS/FS/cust_refund.pm
index 12ab0d6..2d5b3aa 100644
--- a/FS/FS/cust_refund.pm
+++ b/FS/FS/cust_refund.pm
@@ -472,6 +472,19 @@ sub unapplied_sql {
 
 }
 
+sub _upgrade_schema {
+  #my ($class, %opts) = @_;
+
+  my $sql = 'UPDATE cust_refund SET source_paynum = NULL
+               WHERE source_paynum IS NOT NULL
+                 AND NOT EXISTS ( SELECT 1 FROM cust_pay
+                                    WHERE paynum = cust_refund.source_paynum )
+            ';
+  my $sth = dbh->prepare($sql) or die dbh->errstr;
+  $sth->execute or die $sth->errstr;
+  '';
+}
+
 # Used by FS::Upgrade to migrate to a new database.
 sub _upgrade_data {  # class method
   my ($class, %opts) = @_;

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

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




More information about the freeside-commits mailing list