You are here

function casetracker_case_state_edit_submit in Case Tracker 7

Same name and namespace in other branches
  1. 5 casetracker.module \casetracker_case_state_edit_submit()
  2. 6 casetracker_admin.inc \casetracker_case_state_edit_submit()

Processes the submitted results of our case state addition or editing.

File

./casetracker_admin.inc, line 217

Code

function casetracker_case_state_edit_submit($form, &$form_state) {
  $case_state = array(
    'name' => $form_state['values']['name'],
    'realm' => $form_state['values']['realm'],
    'weight' => $form_state['values']['weight'],
  );
  if (!empty($form_state['values']['csid'])) {

    // Update
    $case_state['csid'] = $form_state['values']['csid'];
    drupal_set_message(t('The case state %name has been updated.', array(
      '%name' => $form_state['values']['name'],
    )));
  }
  else {

    // Create
    drupal_set_message(t('The case state %name has been created.', array(
      '%name' => $form_state['values']['name'],
    )));
  }
  casetracker_case_state_save($case_state);
  $form_state['redirect'] = 'admin/config/casetracker/states';
}