From: ivan Date: Wed, 8 Apr 2009 07:32:24 +0000 (+0000) Subject: eliminate all trace of cvv from history records, RT#5093 X-Git-Tag: root_of_svc_elec_features~1292 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=fdbee9ee821385bfbd9578f940eeb8ca74cb9eff eliminate all trace of cvv from history records, RT#5093 --- diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index 168984555..3e3af524c 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -1747,16 +1747,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 && $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 && $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 5abfa6940..7cf4051aa 100644 --- a/FS/FS/Upgrade.pm +++ b/FS/FS/Upgrade.pm @@ -91,6 +91,9 @@ sub upgrade_data { tie my %hash, 'Tie::IxHash', + #cust_main (remove paycvv from history) + 'cust_main' => [], + #msgcat 'msgcat' => [], diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index e696e1bc9..a39ac34c9 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -76,6 +76,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 @@ -8429,6 +8431,15 @@ sub queued_bill { ); } +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