[freeside-commits] freeside/FS/FS Record.pm,1.225,1.226

Erik Levinson levinse at wavetail.420.am
Thu Jul 7 09:00:37 PDT 2011


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv31013/FS/FS

Modified Files:
	Record.pm 
Log Message:
fix BILL payinfo encrypted unnecessarily, RT13190

Index: Record.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Record.pm,v
retrieving revision 1.225
retrieving revision 1.226
diff -u -w -d -r1.225 -r1.226
--- Record.pm	9 Jun 2011 22:09:06 -0000	1.225
+++ Record.pm	7 Jul 2011 16:00:34 -0000	1.226
@@ -6,6 +6,7 @@
              %virtual_fields_cache
              $nowarn_identical $nowarn_classload
              $no_update_diff $no_check_foreign
+             @encrypt_payby
            );
 use Exporter;
 use Carp qw(carp cluck croak confess);
@@ -30,6 +31,8 @@
 
 @ISA = qw(Exporter);
 
+ at encrypt_payby = qw( CARD DCRD CHEK DCHK );
+
 #export dbdef for now... everything else expects to find it here
 @EXPORT_OK = qw(
   dbh fields hfields qsearch qsearchs dbdef jsearch
@@ -531,6 +534,11 @@
          && eval 'defined(@FS::'. $table . '::encrypted_fields)' ) {
       foreach my $record (@return) {
         foreach my $field (eval '@FS::'. $table . '::encrypted_fields') {
+          next if $field eq 'payinfo' 
+                    && ($record->isa('FS::payinfo_transaction_Mixin') 
+                        || $record->isa('FS::payinfo_Mixin') )
+                    && $record->payby
+                    && !grep { $record->payby eq $_ } @encrypt_payby;
           # Set it directly... This may cause a problem in the future...
           $record->setfield($field, $record->decrypt($record->getfield($field)));
         }
@@ -999,6 +1007,11 @@
        && $conf->exists('encryption')
   ) {
     foreach my $field (eval '@FS::'. $table . '::encrypted_fields') {
+      next if $field eq 'payinfo' 
+                && ($self->isa('FS::payinfo_transaction_Mixin') 
+                    || $self->isa('FS::payinfo_Mixin') )
+                && $self->payby
+                && !grep { $self->payby eq $_ } @encrypt_payby;
       $self->{'saved'} = $self->getfield($field);
       $self->setfield($field, $self->encrypt($self->getfield($field)));
     }
@@ -1279,6 +1292,11 @@
        && scalar( eval '@FS::'. $new->table . '::encrypted_fields')
   ) {
     foreach my $field (eval '@FS::'. $new->table . '::encrypted_fields') {
+      next if $field eq 'payinfo' 
+                && ($new->isa('FS::payinfo_transaction_Mixin') 
+                    || $new->isa('FS::payinfo_Mixin') )
+                && $new->payby
+                && !grep { $new->payby eq $_ } @encrypt_payby;
       $saved->{$field} = $new->getfield($field);
       $new->setfield($field, $new->encrypt($new->getfield($field)));
     }



More information about the freeside-commits mailing list