You are here

function support_pm_project_load in Support Ticketing System 6

Same name and namespace in other branches
  1. 7 support_pm/support_pm.module \support_pm_project_load()

Load project from database.

1 call to support_pm_project_load()
support_pm_invoice_ui_form_submit in support_pm/support_pm.module
Add url filter when projects are selected.

File

support_pm/support_pm.module, line 996
Support Project Management. @author Jeremy Andrews <jeremy@tag1consulting.com> @package Support

Code

function support_pm_project_load($projid) {
  static $projects = array();
  if (!isset($projects[$projid])) {
    $projects[$projid] = db_fetch_object(db_query('SELECT * FROM {support_project} WHERE projid = %d', $projid));
    $projects[$projid]->clids = array();
    $result = db_query('SELECT spc.clid, sc.parent FROM {support_project_client} spc LEFT JOIN {support_client} sc ON spc.clid = sc.clid WHERE spc.projid = %d', $projid);
    while ($client = db_fetch_object($result)) {
      $projects[$projid]->clids[] = $client->clid;
      if ($client->parent) {
        $projects[$projid]->parent[$client->clid] = $client->parent;
      }
    }
    drupal_alter('support_pm_project_load', $projects[$projid]);
  }
  return $projects[$projid];
}