You are here

function casetracker_case_state_save in Case Tracker 5

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

Saves a case state.

Parameters

$case_state: An array containing 'name' and 'realm' keys. If no 'csid' is passed, a new state is created, otherwise, we'll update the record that corresponds to that ID.

1 call to casetracker_case_state_save()
casetracker_case_state_edit_submit in ./casetracker.module
Processes the submitted results of our case state addition or editing.

File

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

Code

function casetracker_case_state_save($case_state = NULL) {
  if (!$case_state['name'] || !$case_state['realm']) {
    return NULL;
  }
  $result = isset($case_state['csid']) ? db_query("UPDATE {casetracker_case_states} SET case_state_name = '%s', case_state_realm = '%s', weight = %d WHERE csid = %d", $case_state['name'], $case_state['realm'], $case_state['weight'], $case_state['csid']) : db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm, weight) VALUES ('%s', '%s', %d)", $case_state['name'], $case_state['realm'], $case_state['weight']);
  return $result;
}