You are here

function support_pm_day_load in Support Ticketing System 6

Same name and namespace in other branches
  1. 7 support_pm/support_pm.module \support_pm_day_load()
2 calls to support_pm_day_load()
support_pm_admin_reports in support_pm/support_pm.admin.inc
support_pm_plan_overview_weekly in support_pm/support_pm.module

File

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

Code

function support_pm_day_load($date = NULL, $user = NULL, $client = NULL) {
  if (is_null($date)) {

    // default to this week
    $date = _support_pm_first_day();
  }
  $query = 'SELECT pid, clid, uid, day, hours, comment FROM {support_plan} WHERE day = %d AND hours > 0';
  $args = array(
    $date,
  );
  if (is_object($user) && isset($user->uid)) {
    $query .= ' AND uid = %d';
    $args[] = $user->uid;
  }
  if (is_object($client) && isset($client->clid)) {
    $query .= ' AND clid = %d';
    $args[] = $client->clid;
  }
  $day = array();
  $result = db_query($query, $args);
  while ($row = db_fetch_object($result)) {
    $day[$row->uid][$row->clid] = $row;
  }
  return $day;
}