You are here

function support_pm_default_project in Support Ticketing System 7

Same name and namespace in other branches
  1. 6 support_pm/support_pm.module \support_pm_default_project()

Determine default for a list of projects.

1 call to support_pm_default_project()
support_pm_form_alter in support_pm/support_pm.module

File

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

Code

function support_pm_default_project($projects) {
  $projids = array();
  foreach ($projects as $projid => $project) {
    $projids[] = $projid;
  }
  if (empty($projids)) {
    return 0;
  }
  else {
    return db_query_range('SELECT projid FROM {support_project} WHERE projid IN (:projects) AND disabled = 0 ORDER BY weight ASC', 0, 1, array(
      ':projects' => $projids,
    ))
      ->fetchField();
  }
}