You are here

function casetracker_block_jump_to_case_number_submit in Case Tracker 5

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

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

File

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

Code

function casetracker_block_jump_to_case_number_submit($form_id, $form_values) {
  $case_parts = explode('-', $form_values['case_number']);
  $result = db_fetch_object(db_query("SELECT cc.nid FROM {casetracker_case} cc LEFT JOIN {casetracker_project} cp ON (cc.pid = cp.nid) WHERE cp.project_number = %d AND cc.case_number = %d", $case_parts[0], $case_parts[1]));
  if (!$result->nid) {
    drupal_set_message(t('Your case number was not found.'), 'error');
    return NULL;
  }
  return 'node/' . $result->nid;
}