You are here

function casetracker_block_jump_to_case_number_submit in Case Tracker 7

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

Submit function for our "Jump to case number" block.

File

./casetracker.module, line 738
Enables the handling of projects and their cases.

Code

function casetracker_block_jump_to_case_number_submit($form, $form_state) {
  list($pid, $nid) = explode('-', $form_state['values']['case_number']);
  $case_nid = db_select('casetracker_case', 'c')
    ->fields('c', array(
    'uid',
    'name',
    'status',
    'created',
    'access',
  ))
    ->condition('c.pid', $pid)
    ->condition('c.nid', $nid)
    ->execute()
    ->fetchField();
  if (!$case_nid) {
    drupal_set_message(t('Your case number was not found.'), 'error');
    return;
  }
  drupal_goto('node/' . $case_nid);
}