You are here

function backup_migrate_schedule::edit_form_validate in Backup and Migrate 6.3

Same name and namespace in other branches
  1. 8.2 includes/schedules.inc \backup_migrate_schedule::edit_form_validate()
  2. 8.3 includes/schedules.inc \backup_migrate_schedule::edit_form_validate()
  3. 6.2 includes/schedules.inc \backup_migrate_schedule::edit_form_validate()
  4. 7.3 includes/schedules.inc \backup_migrate_schedule::edit_form_validate()
  5. 7.2 includes/schedules.inc \backup_migrate_schedule::edit_form_validate()

Submit the edit form.

Overrides backup_migrate_item::edit_form_validate

File

includes/schedules.inc, line 557
All of the schedule handling code needed for Backup and Migrate.

Class

backup_migrate_schedule
A schedule class for crud operations.

Code

function edit_form_validate($form, &$form_state) {
  if (!is_numeric($form_state['values']['period']['number']) || $form_state['values']['period']['number'] <= 0) {
    form_set_error('period][number', t('Backup period must be a number greater than 0.'));
  }
  if (!$form_state['values']['delete']) {
    $form_state['values']['keep'] = 0;
  }
  else {
    if ($form_state['values']['deletetype'] == BACKUP_MIGRATE_SMART_DELETE) {
      $form_state['values']['keep'] = BACKUP_MIGRATE_SMART_DELETE;
    }
    else {
      if (!is_numeric($form_state['values']['keep']) || $form_state['values']['keep'] <= 0) {
        form_set_error('keep', t('Number to keep must be a number greater than 0.'));
      }
    }
  }
  parent::edit_form_validate($form, $form_state);
}