From a07658a484990b848a88bbfe0c3251e11f3f593d Mon Sep 17 00:00:00 2001 From: levinse Date: Thu, 21 Jul 2011 03:42:55 +0000 Subject: [PATCH] fix BILL payinfo encrypted unnecessarily, RT13190 --- FS/FS/Upgrade.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm index 3ea554e4a..40d347327 100644 --- a/FS/FS/Upgrade.pm +++ b/FS/FS/Upgrade.pm @@ -129,6 +129,24 @@ sub upgrade { } + # decrypt all payinfo where payby = BILL + # kind of a weird spot for this, but it's better than duplicating + # all this code in each class... + my @decrypt_tables = qw( cust_main cust_pay_void cust_pay cust_refund cust_pay_pending ); + foreach my $table ( @decrypt_tables ) { + my @objects = qsearch({ 'table' => $table, + 'hashref' => { 'payby' => 'BILL', }, + 'extra_sql' => 'AND LENGTH(payinfo) > 100', + }); + foreach my $object ( @objects ) { + my $payinfo = $object->decrypt($object->payinfo); + die "error decrypting payinfo" if $payinfo eq $object->payinfo; + $object->payinfo($payinfo); + my $error = $object->replace; + die $error if $error; + } + } + } =item upgrade_data -- 2.11.0