From: Ivan Kohler Date: Wed, 1 Feb 2017 17:31:02 +0000 (-0800) Subject: fix upgrades so they don't try to tokenize non-cards, RT#71513 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=238d6ec0e724981f7142ec6eff8b39da9b2d02fb;p=freeside.git fix upgrades so they don't try to tokenize non-cards, RT#71513 --- diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm index 8b1a60ab1..ab2e39c9e 100644 --- a/FS/FS/cust_main/Billing_Realtime.pm +++ b/FS/FS/cust_main/Billing_Realtime.pm @@ -2462,7 +2462,7 @@ CUSTLOOP: } if ($require_tokenized && $opt{'daily'}) { - $log->critical("Untokenized card number detected in cust_payby ".$cust_payby->custpaybynum); + $log->info("Untokenized card number detected in cust_payby ".$cust_payby->custpaybynum. '; tokenizing'); $dbh->commit or die $dbh->errstr; # commit log message } @@ -2563,7 +2563,7 @@ CUSTLOOP: } if ($require_tokenized && $opt{'daily'}) { - $log->critical("Untokenized card number detected in $table ".$record->get($record->primary_key)); + $log->info("Untokenized card number detected in $table ".$record->get($record->primary_key). ';tokenizing'); $dbh->commit or die $dbh->errstr; # commit log message } @@ -2705,7 +2705,15 @@ sub _token_check_next_recnum { my $recnum = shift @$recnums; return $recnum if $recnum; my $tclass = 'FS::'.$table; - my $sth = $dbh->prepare('SELECT '.$tclass->primary_key.' FROM '.$table.' ORDER BY '.$tclass->primary_key.' LIMIT '.$step.' OFFSET '.$$offset) or die $dbh->errstr; + my $sth = $dbh->prepare( + 'SELECT '.$tclass->primary_key. + ' FROM '.$table. + " WHERE payby IN ( 'CARD', 'DCRD' ) ". + " AND ( length(payinfo) > 80 OR payinfo NOT LIKE '99%' )". + ' ORDER BY '.$tclass->primary_key. + ' LIMIT '.$step. + ' OFFSET '.$$offset + ) or die $dbh->errstr; $sth->execute() or die $sth->errstr; my @recnums; while (my $rec = $sth->fetchrow_hashref) {