From: Ivan Kohler Date: Sat, 4 Jun 2016 00:23:02 +0000 (-0700) Subject: Merge branch 'master' of git.freeside.biz:/home/git/freeside X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=d22baa4e71bfa9e153c1fe1152ff4c748f1d935c;hp=-c Merge branch 'master' of git.freeside.biz:/home/git/freeside --- d22baa4e71bfa9e153c1fe1152ff4c748f1d935c diff --combined FS/FS/cust_main.pm index 0d89ff463,afecb83f5..cb5181d89 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@@ -1991,9 -1991,7 +1991,9 @@@ sub cust_payby 'hashref' => { 'custnum' => $self->custnum }, 'order_by' => "ORDER BY payby IN ('CARD','CHEK') DESC, weight ASC", }; - $search->{'extra_sql'} = ' AND payby IN ( ' . join(',', map { dbh->quote($_) } @payby) . ' ) ' + $search->{'extra_sql'} = ' AND payby IN ( '. + join(',', map dbh->quote($_), @payby). + ' ) ' if @payby; qsearch($search); @@@ -2338,6 -2336,8 +2338,8 @@@ Removes the I field from the da If there is an error, returns the error, otherwise returns false. + DEPRECATED. Use L instead. + =cut sub remove_cvv { @@@ -4524,6 -4524,33 +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