From: Ivan Kohler Date: Thu, 4 Feb 2016 18:24:49 +0000 (-0800) Subject: in a new 5.x install, don't try to upgrade from 3.x-style payby, those fields are... X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=b664241d5e97c8bd2c2d44a961d08aa8c1f0feb5 in a new 5.x install, don't try to upgrade from 3.x-style payby, those fields are gone --- diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index a15a36967..206f1b0bf 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -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); }