From 15c6517d363aa473403fec9c8a7df4d9e4b01da1 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 3 Oct 2013 14:00:07 +0100 Subject: [PATCH] CRM-13475 Fix credit-card error messages ---------------------------------------- * CRM-13475: Entering an invalid credit card number gives the wrong field validation error http://issues.civicrm.org/jira/browse/CRM-13475 --- CRM/Core/Payment/Form.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CRM/Core/Payment/Form.php b/CRM/Core/Payment/Form.php index 48faa6b0bd..f193753892 100644 --- a/CRM/Core/Payment/Form.php +++ b/CRM/Core/Payment/Form.php @@ -182,7 +182,7 @@ class CRM_Core_Payment_Form { 'title' => ts('Card Type'), 'cc_field' => TRUE, 'attributes' => $creditCardType, - 'is_required' => TRUE, + 'is_required' => FALSE, ); } @@ -237,7 +237,7 @@ class CRM_Core_Payment_Form { /** * Function to add all the credit card fields * - * @return None + * @return void * @access public */ static function buildCreditCard(&$form, $useRequired = FALSE) { @@ -363,6 +363,9 @@ class CRM_Core_Payment_Form { $errors['cvv2'] = ts('Please enter a valid Credit Card Verification Number'); } } + elseif (!empty($values['credit_card_number'])) { + $errors['credit_card_number'] = ts('Please enter a valid Credit Card Number and Type'); + } } /** -- 2.25.1