From 4d1fd569d814600246f97709b8982c22621022df Mon Sep 17 00:00:00 2001 From: kurund Date: Sat, 28 Feb 2015 02:58:54 +0530 Subject: [PATCH] CRM-15756, validation for CC fixes ---------------------------------------- * CRM-15756: Back-office Submit Credit Card Contribution form: card # validation is no longer working https://issues.civicrm.org/jira/browse/CRM-15756 --- CRM/Core/Payment/Form.php | 7 ++----- CRM/Member/Form.php | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/CRM/Core/Payment/Form.php b/CRM/Core/Payment/Form.php index 6c9182369b..8b81511e93 100644 --- a/CRM/Core/Payment/Form.php +++ b/CRM/Core/Payment/Form.php @@ -254,7 +254,7 @@ class CRM_Core_Payment_Form { * * @return bool */ - public static function buildPaymentForm($form, $processor, $isBillingDataOptional) { + public static function buildPaymentForm(&$form, $processor, $isBillingDataOptional) { //if the form has address fields assign to the template so the js can decide what billing fields to show $profileAddressFields = $form->get('profileAddressFields'); if (!empty($profileAddressFields)) { @@ -353,7 +353,7 @@ class CRM_Core_Payment_Form { * Called within the scope of a QF formRule function */ public static function validateCreditCard($values, &$errors) { - if (!empty($values['credit_card_type'])) { + if (!empty($values['credit_card_type']) || !empty($values['credit_card_number'])) { if (!empty($values['credit_card_number']) && !CRM_Utils_Rule::creditCardNumber($values['credit_card_number'], $values['credit_card_type']) ) { @@ -365,9 +365,6 @@ class CRM_Core_Payment_Form { $errors['cvv2'] = ts('Please enter a valid Card Verification Number'); } } - elseif (!empty($values['credit_card_number'])) { - $errors['credit_card_number'] = ts('Please enter a valid Card Number'); - } } /** diff --git a/CRM/Member/Form.php b/CRM/Member/Form.php index cb933329be..d8e1c9e39e 100644 --- a/CRM/Member/Form.php +++ b/CRM/Member/Form.php @@ -129,7 +129,7 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment { $this->_processors, TRUE, array('onChange' => "buildAutoRenew( null, this.value );") ); - CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, TRUE); + CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE); } if ($this->_action & CRM_Core_Action::RENEW) { $this->addButtons(array( -- 2.25.1