CRM-13475 Fix credit-card error messages
[civicrm-core.git] / CRM / Core / Payment / Form.php
index 0905d3a9c1eb26e998b339d73b03bc09bd47784a..f193753892eec2a6cd9adccebf3f10871b953902 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
@@ -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');
+    }
   }
 
   /**