You are here

function _casetracker_next_case_number in Case Tracker 5

Returns the next case number for use in a project. Case numbers are unique to a project, so there will be multiple case number 100s, etc. See also _casetracker_next_project_number().

Parameters

$project_id: The node ID of the project this case is assigned to.

1 call to _casetracker_next_case_number()
casetracker_nodeapi in ./casetracker.module
Implementation of hook_nodeapi().

File

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

Code

function _casetracker_next_case_number($project_id) {
  $project_case_numbers = variable_get('casetracker_current_case_numbers', array());
  $case_number = ++$project_case_numbers[$project_id];

  // cases increment by one per project.
  variable_set('casetracker_current_case_numbers', $project_case_numbers);
  return $case_number;
}