summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2009-04-08 07:32:50 +0000
committerivan <ivan>2009-04-08 07:32:50 +0000
commit1ea6ad209b3117480bf31473d790ff46115dcde0 (patch)
tree5f92b3a09156bb92d5fda8bbe452a9f8d7732133
parent56747f35e2e457897fb44e30bf1b67560a155591 (diff)
eliminate all trace of cvv from history records, RT#5093
-rw-r--r--FS/FS/Record.pm12
-rw-r--r--FS/FS/Upgrade.pm3
-rw-r--r--FS/FS/cust_main.pm11
3 files changed, 21 insertions, 5 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index f35fe4c1a..3f065b8d5 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -1263,16 +1263,18 @@ sub _h_statement {
$time ||= time;
+ my %nohistory = map { $_=>1 } $self->nohistory_fields;
+
my @fields =
- grep { defined($self->getfield($_)) && $self->getfield($_) ne "" }
+ grep { defined($self->get($_)) && $self->get($_) ne "" && ! $nohistory{$_} }
real_fields($self->table);
;
- # If we're encrypting then don't ever store the payinfo or CVV2 in the history....
- # You can see if it changed by the paymask...
- if ($conf->exists('encryption') ) {
- @fields = grep $_ ne 'payinfo' && $_ ne 'cvv2', @fields;
+ # If we're encrypting then don't store the payinfo in the history
+ if ( $conf->exists('encryption') ) {
+ @fields = grep { $_ ne 'payinfo' } @fields;
}
+
my @values = map { _quote( $self->getfield($_), $self->table, $_) } @fields;
"INSERT INTO h_". $self->table. " ( ".
diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm
index 6adc736df..7f353636d 100644
--- a/FS/FS/Upgrade.pm
+++ b/FS/FS/Upgrade.pm
@@ -86,6 +86,9 @@ sub upgrade_data {
tie my %hash, 'Tie::IxHash',
+ #cust_main (remove paycvv from history)
+ 'cust_main' => [],
+
#reason type and reasons
'reason_type' => [],
'reason' => [],
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 99ed9a6ab..4dc1a4fa7 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -74,6 +74,8 @@ $skip_fuzzyfiles = 0;
$ignore_expired_card = 0;
@encrypted_fields = ('payinfo', 'paycvv');
+sub nohistory_fields { ('paycvv'); }
+
@paytypes = ('', 'Personal checking', 'Personal savings', 'Business checking', 'Business savings');
#ask FS::UID to run this stuff for us later
@@ -6239,6 +6241,15 @@ sub _agent_plandata {
}
+sub _upgrade_data { #class method
+ my ($class, %opts) = @_;
+
+ my $sql = 'UPDATE h_cust_main SET paycvv = NULL';
+ my $sth = dbh->prepare($sql) or die dbh->errstr;
+ $sth->execute or die $sth->errstr;
+
+}
+
=back
=head1 BUGS