[freeside-commits] branch FREESIDE_3_BRANCH updated. 00277822362dc6b54f9ba8276ff05cbb55bc90d0

Ivan ivan at 420.am
Wed Feb 1 09:21:04 PST 2017


The branch, FREESIDE_3_BRANCH has been updated
       via  00277822362dc6b54f9ba8276ff05cbb55bc90d0 (commit)
      from  5744a93e395c6d7b4203795ca2aec2527b225ee5 (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 00277822362dc6b54f9ba8276ff05cbb55bc90d0
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Feb 1 09:20:44 2017 -0800

    fix Tokenized payinfo on upgrade if we can, RT#71513

diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 72bc10f..cd8f573 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -5761,8 +5761,11 @@ sub queueable_upgrade {
     FS::upgrade_journal->set_done('clear_payinfo_history');
   }
 
-  # encrypt old records
-  if ($conf->exists('encryption') && !FS::upgrade_journal->is_done('encryption_check')) {
+  # fix Tokenized paycardtype and encrypt old records
+  if (    ! FS::upgrade_journal->is_done('paycardtype_Tokenized')
+       || ! FS::upgrade_journal->is_done('encryption_check')
+     )
+  {
 
     # allow replacement of closed cust_pay/cust_refund records
     local $FS::payinfo_Mixin::allow_closed_replace = 1;
@@ -5788,6 +5791,7 @@ sub queueable_upgrade {
         if (!$record->custnum && $table eq 'cust_pay_pending') {
           $record->set('custnum_pending',1);
         }
+        $record->paycardtype('') if $record->paycardtype eq 'Tokenized';
 
         local($ignore_expired_card) = 1;
         local($ignore_banned_card) = 1;
@@ -5799,7 +5803,8 @@ sub queueable_upgrade {
       }
     }
 
-    FS::upgrade_journal->set_done('encryption_check');
+    FS::upgrade_journal->set_done('paycardtype_Tokenized');
+    FS::upgrade_journal->set_done('encryption_check') if $conf->exists('encryption');
   }
 
 }
@@ -5815,6 +5820,8 @@ sub _upgrade_next_recnum {
   my $sql = 'SELECT '.$tclass->primary_key.
             ' FROM '.$table.
             ' WHERE '.$tclass->primary_key.' > '.$$lastrecnum.
+            "   AND payby IN ( 'CARD', 'DCRD', 'CHEK', 'DCHK' ) ".
+            "   AND ( length(payinfo) > 80 OR paycardtype = 'Tokenized' ) ".
             ' ORDER BY '.$tclass->primary_key.' LIMIT 500';;
   my $sth = $dbh->prepare($sql) or die $dbh->errstr;
   $sth->execute() or die $sth->errstr;

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

Summary of changes:
 FS/FS/cust_main.pm |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)




More information about the freeside-commits mailing list