You are here

function uc_restrict_qty_settings_validate in Ubercart Restrict Qty 7

Same name and namespace in other branches
  1. 6.2 uc_restrict_qty.module \uc_restrict_qty_settings_validate()
  2. 6 uc_restrict_qty.module \uc_restrict_qty_settings_validate()

Validates the textfield on the product features settings form.

1 string reference to 'uc_restrict_qty_settings_validate'
uc_restrict_qty_form_alter in ./uc_restrict_qty.module
Implements hook_form_alter().

File

./uc_restrict_qty.module, line 81
Restrict the quantity on specified products so that only specified quantity may be purchased at a time.

Code

function uc_restrict_qty_settings_validate($form, &$form_state) {
  if (!is_numeric($form_state['values']['uc_restrict_qty_global']) || $form_state['values']['uc_restrict_qty_global'] < 0) {
    form_set_error('uc_restrict_qty_global', t('You must enter 0 or a positive number value.'));
  }
  if (!is_numeric($form_state['values']['uc_restrict_qty_default_qty']) || $form_state['values']['uc_restrict_qty_default_qty'] < 0) {
    form_set_error('uc_restrict_qty_default_qty', t('You must enter 0 or a positive number value.'));
  }
}