diff options
author | Ivan Kohler <ivan@freeside.biz> | 2016-02-12 10:52:49 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2016-02-12 10:52:49 -0800 |
commit | 4977f664e214c799a4cfb65dc023daaa0bfd51dc (patch) | |
tree | 919904577f195963850c5188efd7e36f3885df12 | |
parent | 64cd32971341855c3d5e9dee9bf0a1e149eba740 (diff) |
payby upgrade first so other cust_main->replace operations don't error out, RT#32043
-rw-r--r-- | FS/FS/cust_main.pm | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 0a765289c..f0a152bc0 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -5496,27 +5496,6 @@ sub _upgrade_data { #class method local($skip_fuzzyfiles) = 1; local($import) = 1; #prevent automatic geocoding (need its own variable?) - FS::cust_main::Location->_upgrade_data(%opts); - - unless ( FS::upgrade_journal->is_done('cust_main__trimspaces') ) { - - foreach my $cust_main ( qsearch({ - 'table' => 'cust_main', - 'hashref' => {}, - 'extra_sql' => 'WHERE '. - join(' OR ', - map "$_ LIKE ' %' OR $_ LIKE '% ' OR $_ LIKE '% %'", - qw( first last company ) - ), - }) ) { - my $error = $cust_main->replace; - die $error if $error; - } - - FS::upgrade_journal->set_done('cust_main__trimspaces'); - - } - 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 @@ -5545,6 +5524,7 @@ sub _upgrade_data { #class method map { $_ => $cust_main->$_(); } @payfields }; + local($FS::cust_payby::ignore_cardtype) = 1; my $error = $cust_payby->insert; die $error if $error; @@ -5582,6 +5562,27 @@ sub _upgrade_data { #class method FS::upgrade_journal->set_done('cust_main__cust_payby'); } + FS::cust_main::Location->_upgrade_data(%opts); + + unless ( FS::upgrade_journal->is_done('cust_main__trimspaces') ) { + + foreach my $cust_main ( qsearch({ + 'table' => 'cust_main', + 'hashref' => {}, + 'extra_sql' => 'WHERE '. + join(' OR ', + map "$_ LIKE ' %' OR $_ LIKE '% ' OR $_ LIKE '% %'", + qw( first last company ) + ), + }) ) { + my $error = $cust_main->replace; + die $error if $error; + } + + FS::upgrade_journal->set_done('cust_main__trimspaces'); + + } + $class->_upgrade_otaker(%opts); } |