From: ivan Date: Thu, 17 Jun 2010 19:45:45 +0000 (+0000) Subject: fix fallout from N/A payinfo, RT#8809 X-Git-Tag: root_of_svc_elec_features~144 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=78fe7364c8d54eb76a908f900326a673d7d1e1fc fix fallout from N/A payinfo, RT#8809 --- diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 261bb4fd0..53db722dd 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -693,6 +693,10 @@ sub _upgrade_data { #class method warn "$me upgrading $class\n" if $DEBUG; + ## + # otaker/ivan upgrade + ## + #not the most efficient, but hey, it only has to run once my $where = "WHERE ( otaker IS NULL OR otaker = '' OR otaker = 'ivan' ) ". @@ -748,6 +752,33 @@ sub _upgrade_data { #class method } + ### + # payinfo N/A upgrade + ### + + my @na_cust_pay = qsearch( { + 'table' => 'cust_pay', + 'hashref' => { 'payinfo' => 'N/A' }, + 'extra_sql' => "AND payby IN ( 'CARD', 'CHEK' )", + } ); + + foreach my $na ( @na_cust_pay ) { + my $cust_pay_pending = + qsearchs('cust_pay_pending', { 'paynum' => $na->paynum } ); + $na->$_($cust_pay_pending->$_) for qw( payinfo paymask ); + my $error = $na->replace; + if ( $error ) { + warn " *** WARNING: Error updating payinfo for payment paynum ". + $na->paynun. ": $error\n"; + next; + } + + } + + ### + # otaker->usernum upgrade + ### + $class->_upgrade_otaker(%opts); }