in a new 5.x install, don't try to upgrade from 3.x-style payby, those fields are...
authorIvan Kohler <ivan@freeside.biz>
Thu, 4 Feb 2016 18:24:49 +0000 (10:24 -0800)
committerIvan Kohler <ivan@freeside.biz>
Thu, 4 Feb 2016 18:24:49 +0000 (10:24 -0800)
FS/FS/cust_main.pm

index a15a369..206f1b0 100644 (file)
@@ -5144,71 +5144,6 @@ sub _upgrade_data { #class method
 
   }
 
-  unless ( FS::upgrade_journal->is_done('cust_main__cust_payby') ) {
-
-    #we don't want to decrypt them, just stuff them as-is into cust_payby
-    local(@encrypted_fields) = ();
-
-    local($FS::cust_payby::ignore_expired_card) = 1;
-    local($FS::cust_payby::ignore_banned_card) = 1;
-
-    my @payfields = qw( payby payinfo paycvv paymask
-                        paydate paystart_month paystart_year payissue
-                        payname paystate paytype payip
-                      );
-
-    my $search = new FS::Cursor {
-      'table'     => 'cust_main',
-      'extra_sql' => " WHERE ( payby IS NOT NULL AND payby != '' ) ",
-    };
-
-    while (my $cust_main = $search->fetch) {
-
-      unless ( $cust_main->payby =~ /^(BILL|COMP)$/ ) {
-
-        my $cust_payby = new FS::cust_payby {
-          'custnum' => $cust_main->custnum,
-          'weight'  => 1,
-          map { $_ => $cust_main->$_(); } @payfields
-        };
-
-        my $error = $cust_payby->insert;
-        die $error if $error;
-
-      }
-
-      # at the time we do this, also migrate paytype into cust_pay_batch
-      # so that batches that are open before the migration can still be 
-      # processed
-      my @cust_pay_batch = qsearch('cust_pay_batch', {
-          'custnum' => $cust_main->custnum,
-          'payby'   => 'CHEK',
-          'paytype' => '',
-      });
-      foreach my $cust_pay_batch (@cust_pay_batch) {
-        $cust_pay_batch->set('paytype', $cust_main->get('paytype'));
-        my $error = $cust_pay_batch->replace;
-        die "$error (setting cust_pay_batch.paytype)" if $error;
-      }
-
-      $cust_main->complimentary('Y') if $cust_main->payby eq 'COMP';
-
-      $cust_main->invoice_attn( $cust_main->payname )
-        if $cust_main->payby eq 'BILL' && $cust_main->payname;
-      $cust_main->po_number( $cust_main->payinfo )
-        if $cust_main->payby eq 'BILL' && $cust_main->payinfo;
-
-      $cust_main->setfield($_, '') foreach @payfields;
-      my $error = $cust_main->replace;
-      die "Error upgradging payment information for custnum ".
-          $cust_main->custnum. ": $error"
-        if $error;
-
-    };
-
-    FS::upgrade_journal->set_done('cust_main__cust_payby');
-  }
-
   $class->_upgrade_otaker(%opts);
 
 }