function casetracker_case_state_save in Case Tracker 6
Same name and namespace in other branches
- 5 casetracker.module \casetracker_case_state_save()
- 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_admin.inc - Processes the submitted results of our case state addition or editing.
File
- ./
casetracker.module, line 633 - 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;
}
// Need to collect information into another array since the db columns have different names : (
$record = array(
'case_state_name' => $case_state['name'],
'case_state_realm' => $case_state['realm'],
'weight' => $case_state['weight'],
);
if (isset($case_state['csid'])) {
$record['csid'] = $case_state['csid'];
drupal_write_record('casetracker_case_states', $record, array(
'csid',
));
}
else {
drupal_write_record('casetracker_case_states', $record);
}
// Update translations
if (function_exists('i18nstrings_update')) {
i18nstrings_update('casetracker:case_states:' . $record['csid'] . ':name', $case_state['name']);
}
return $result;
}