You are here

function support_invoice_ui_form_submit in Support Ticketing System 6

File

./support.module, line 3878
support.module

Code

function support_invoice_ui_form_submit($form, &$form_state) {
  $tids = array();
  if (!empty($form_state['values']['tids'])) {
    foreach ($form_state['values']['tids'] as $tid) {
      if ($tid == -1) {
        $tids = array(
          'null',
        );
        break;
      }
      else {
        if ($tid == 0) {
          $tids = '';
          break;
        }
        else {
          $tids[$tid] = $tid;
        }
      }
    }
    if ($tids) {
      $tids = implode(',', $tids);
    }
  }
  $path = drupal_get_path_alias(isset($_GET['q']) ? $_GET['q'] : '');
  $query = array();
  foreach ($_GET as $key => $value) {
    if (!in_array($key, array(
      'q',
      'tid',
    ))) {
      $query[$key] = $value;
    }
  }
  if ($tids) {
    $query['tid'] = $tids;
  }
  drupal_goto($path, $query);
}