CRM-13475 Fix credit-card error messages
[civicrm-core.git] / CRM / Core / Payment / Form.php
index 48faa6b0bd9ce116826da90e980410cb9bbe6b26..f193753892eec2a6cd9adccebf3f10871b953902 100644 (file)
@@ -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');
+    }
   }
 
   /**