You are here

function _support_current_client in Support Ticketing System 6

Same name and namespace in other branches
  1. 7 support.module \_support_current_client()

Return the currently active client.

10 calls to _support_current_client()
support_block in ./support.module
Implemtation of hook_block().
support_invoice_ui_form in ./support.module
Provide form for selecting projects.
support_pm_db_rewrite_sql in support_pm/support_pm.module
support_pm_form_alter in support_pm/support_pm.module
support_pm_invoice_ui_form in support_pm/support_pm.module
Provide form for selecting projects.

... See full list

File

./support.module, line 3635
support.module

Code

function _support_current_client() {
  $clients = _support_available_clients();

  // Allow plug-in modules to affect which is the currently active client.
  drupal_alter('support_current_client', $clients);
  if (count($clients) == 1) {
    $client = key($clients);
  }
  else {
    if (count($clients)) {
      if (is_numeric($_SESSION['support_client'])) {
        $client = $_SESSION['support_client'];
      }
      else {
        if (!user_access('can select client')) {

          // TODO: It should be possible to set a default client.  Perhaps allow
          // a weight to be assigned to clients -- then we select the heaviest
          // matching client...?
          $client = key($clients);
        }
      }
    }
    else {
      return NULL;
    }
  }
  return $client;
}