You are here

function support_substatus_load in Support Ticketing System 6

Load substatus from database.

File

support_substatus/support_substatus.module, line 458
Support Substatus -- allows per-status sub-status values, so for example a "pending" ticket can be further marked with "needs review", etc. @author Jeremy Andrews <jeremy@tag1consulting.com> @package Support

Code

function support_substatus_load($ssid) {
  static $substatus = array();
  if (!isset($substatus[$ssid])) {
    $substatus[$ssid] = db_fetch_object(db_query('SELECT * FROM {support_substatus} WHERE ssid = %d', $ssid));
    $substatus[$ssid]->clids = array();
    $result = db_query('SELECT stid FROM {support_substatus_state} WHERE ssid = %d', $ssid);
    while ($state = db_fetch_object($result)) {
      $substatus[$ssid]->state[] = $state->stid;
    }
    $result = db_query('SELECT clid FROM {support_substatus_client} WHERE ssid = %d', $ssid);
    while ($client = db_fetch_object($result)) {
      $substatus[$ssid]->clids[] = $client->clid;
    }
    drupal_alter('support_substatus_load', $substatus[$ssid]);
  }
  return $substatus[$ssid];
}