[freeside-commits] branch FREESIDE_3_BRANCH updated. 4da27fb5faa7c5655bed013a8edba61bb9c782c6
Ivan
ivan at 420.am
Mon Mar 6 18:31:28 PST 2017
The branch, FREESIDE_3_BRANCH has been updated
via 4da27fb5faa7c5655bed013a8edba61bb9c782c6 (commit)
from 71fa1a7043b16d22a5e6d0c81ee33f5d62d50f49 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 4da27fb5faa7c5655bed013a8edba61bb9c782c6
Author: Ivan Kohler <ivan at freeside.biz>
Date: Mon Mar 6 18:31:25 2017 -0800
add restore paymask script, RT#74758
diff --git a/bin/cust_main.restore-paymask b/bin/cust_main.restore-paymask
new file mode 100755
index 0000000..c6c8a75
--- /dev/null
+++ b/bin/cust_main.restore-paymask
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+
+use strict;
+use FS::UID qw( adminsuidsetup );
+use FS::Record qw( qsearch dbh );
+
+adminsuidsetup shift
+ or die "Usage: cust_main.restore-paymask freeside_username\n";
+
+foreach my $cust_main (
+ qsearch({ 'table' => 'cust_main',
+ 'extra_sql' => q[WHERE payby IN ('CARD','DCRD') AND paymask IS NULL OR paymask = 'N/A (tokenized)'],
+ })
+) {
+
+ my $custnum = $cust_main->custnum;
+
+ my $paymask = FS::Record->scalar_sql(qq[
+ SELECT paymask FROM h_cust_main WHERE custnum = $custnum AND history_action = 'replace_old' AND paymask IS NOT NULL AND paymask != 'N/A (tokenized)' ORDER BY historynum desc LIMIT 1
+ ]);
+
+ #dbh->do(
+ print
+ qq[UPDATE cust_main SET paymask = '$paymask' WHERE custnum = $custnum;]
+ ."\n"
+ ;
+
+ #print "$custnum: $paymask\n";
+}
+
+1;
-----------------------------------------------------------------------
Summary of changes:
bin/cust_main.restore-paymask | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
create mode 100755 bin/cust_main.restore-paymask
More information about the freeside-commits
mailing list