You are here

function uc_recurring_order_settings_form_validate in UC Recurring Payments and Subscriptions 7.2

Same name and namespace in other branches
  1. 6.2 modules/uc_recurring_order/uc_recurring_order.module \uc_recurring_order_settings_form_validate()

@todo Please document this function.

See also

http://drupal.org/node/1354

File

modules/uc_recurring_order/uc_recurring_order.module, line 60
Provides a way to duplicate entire orders.

Code

function uc_recurring_order_settings_form_validate($form, &$form_state) {
  $options = preg_split('/[\\r\\n]+/', $form_state['values']['interval_options']);
  $errors = '';
  foreach ($options as $key => $value) {
    if (!$value) {
      continue;
    }
    $i = explode('|', $value);
    if (strtotime($i[0])) {
      $intervals[$i[0]] = isset($i[1]) && $i[1] !== '' ? $i[1] : $i[0];
    }
    else {
      $errors .= t('!error is not valid strtotime format <br />', array(
        '!error' => $i[0],
      ));
    }
  }
  if (!empty($errors)) {
    return form_set_error('interval_options', $errors);
  }
  $form_state['values']['intervals'] = $intervals;
}