Example #1
0
 /**
  * Set the current form action.  Should only be called by Controller.
  */
 public static function set_current_action($action)
 {
     self::$current_action = $action;
 }
 public function php($data)
 {
     // Check if we should do a payment
     if (Form::current_action() == 'dopayment' && !empty($data['PaymentMethod'])) {
         $gateway = $data['PaymentMethod'];
         // If the gateway isn't manual and not offsite, Check for credit-card fields!
         if (!GatewayInfo::isManual($gateway) && !GatewayInfo::isOffsite($gateway)) {
             // Merge the required fields and the Credit-Card fields that are required for the gateway
             $this->required = array_merge($this->required, array_intersect(array('type', 'name', 'number', 'startMonth', 'startYear', 'expiryMonth', 'expiryYear', 'cvv', 'issueNumber'), GatewayInfo::requiredFields($gateway)));
         }
     }
     return parent::php($data);
 }