summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2010-06-17 19:45:45 +0000
committerivan <ivan>2010-06-17 19:45:45 +0000
commit78fe7364c8d54eb76a908f900326a673d7d1e1fc (patch)
tree885d7b1e2aad6a5b5e2d539c2371a9b76b565506
parentcbd0ff16c1919dfed551023111221ade89b76b06 (diff)
fix fallout from N/A payinfo, RT#8809
-rw-r--r--FS/FS/cust_pay.pm31
1 files changed, 31 insertions, 0 deletions
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);
}