X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_main.pm;h=cb5181d8925bde4ed3443c401db0ff980e2c10c5;hp=0d89ff46385115b40de6ca6869dbf9bb1c470b55;hb=d22baa4e71bfa9e153c1fe1152ff4c748f1d935c;hpb=a60ce94f914fb7380546d19713fece0ed208bdc6 diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 0d89ff463..cb5181d89 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2338,6 +2338,8 @@ Removes the I field from the database directly. If there is an error, returns the error, otherwise returns false. +DEPRECATED. Use L instead. + =cut sub remove_cvv { @@ -4524,6 +4526,33 @@ PAYBYLOOP: } +=item remove_cvv_from_cust_payby PAYINFO + +Removes paycvv from associated cust_payby with matching PAYINFO. + +=cut + +sub remove_cvv_from_cust_payby { + my ($self,$payinfo) = @_; + + my $oldAutoCommit = $FS::UID::AutoCommit; + local $FS::UID::AutoCommit = 0; + my $dbh = dbh; + + foreach my $cust_payby ( qsearch('cust_payby',{ custnum => $self->custnum }) ) { + next unless $cust_payby->payinfo eq $payinfo; # can't qsearch on payinfo + $cust_payby->paycvv(''); + my $error = $cust_payby->replace; + if ($error) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + } + + $dbh->commit or die $dbh->errstr if $oldAutoCommit; + ''; +} + =back =head1 CLASS METHODS