top.window.location = '../../index.php'"; exit; } require_once __DIR__ . "/" . "../../includes/include_basics_only.php"; require_once __DIR__ . "/" . "../../includes/classes/ConnectPDO.php"; require_once __DIR__ . "/" . "../../includes/classes/worktime/Worktime.php"; include_once __DIR__ . "/" . "../../includes/functions/getWorktimeProfile.php"; require_once __DIR__ . "/" . "../../includes/components/html2text-master/vendor/autoload.php"; $auth = new AuthNew($_SESSION['s_logado'], $_SESSION['s_nivel'], 2, 1); use includes\classes\ConnectPDO; $conn = ConnectPDO::getInstance(); $uareas = $_SESSION['s_uareas']; $post = (isset($_POST) ? $_POST : ''); $imgsPath = "../../includes/imgs/"; $iconFrozen = ""; $iconOutOfWorktime = ""; $iconTicketClosed = ""; $config = getConfig($conn); $percLimit = $config['conf_sla_tolerance']; $exception = ""; $calc_slas = (isset($post['calc_slas']) && $post['calc_slas'] == 'on' ? true : false); $options = [ 'area' => [ 'label' => TRANS('SERVICE_AREA'), 'table' => 'sistemas', 'field_id' => 'sis_id', 'field_name' => 'sistema', 'table_reference' => 'ocorrencias', 'table_reference_alias' => 'o', 'field_reference' => 'sistema', 'sql_alias' => 'o.sistema', 'alias' => 'ar', 'value' => '' ], 'status' => [ 'label' => TRANS('COL_STATUS'), 'table' => 'status', 'field_id' => 'stat_id', 'field_name' => 'status', 'table_reference' => 'ocorrencias', 'table_reference_alias' => 'o', 'field_reference' => 'status', 'sql_alias' => 'o.status', 'alias' => 'st', 'value' => '' ], 'client' => [ 'label' => TRANS('CLIENT'), 'table' => 'clients', 'field_id' => 'id', 'field_name' => 'nickname', 'table_reference' => 'ocorrencias', 'table_reference_alias' => 'o', 'field_reference' => 'client', 'sql_alias' => 'cl.id', 'alias' => 'cl', 'value' => '' ], 'requester_area' => [ 'label' => TRANS('REQUESTER_AREA'), 'table' => 'sistemas', 'field_id' => 'sis_id', 'field_name' => 'sistema', 'table_reference' => 'usuarios', 'table_reference_alias' => 'ua', 'field_reference' => 'AREA', 'sql_alias' => 'asol.sis_id', 'alias' => 'uar', 'value' => '' ], 'priority' => [ 'label' => TRANS('COL_PRIORITY'), 'table' => 'prior_atend', 'field_id' => 'pr_cod', 'field_name' => 'pr_desc', 'table_reference' => 'ocorrencias', 'table_reference_alias' => 'o', 'field_reference' => 'oco_prior', 'sql_alias' => 'o.oco_prior', 'alias' => 'pr', 'value' => '' ], 'issue_type' => [ 'label' => TRANS('ISSUE_TYPE'), 'table' => 'problemas', 'field_id' => 'prob_id', 'field_name' => 'problema', 'table_reference' => 'ocorrencias', 'table_reference_alias' => 'o', 'field_reference' => 'problema', 'sql_alias' => 'p.prob_id', 'alias' => 'prob', 'value' => '' ], 'department' => [ 'label' => TRANS('DEPARTMENT'), 'table' => 'localizacao', 'field_id' => 'loc_id', 'field_name' => 'local', 'table_reference' => 'ocorrencias', 'table_reference_alias' => 'o', 'field_reference' => 'local', 'sql_alias' => 'l.loc_id', 'alias' => 'loc', 'value' => '' ], 'unit' => [ 'label' => TRANS('COL_UNIT'), 'table' => 'instituicao', 'field_id' => 'inst_cod', 'field_name' => 'inst_nome', 'table_reference' => 'ocorrencias', 'table_reference_alias' => 'o', 'field_reference' => 'instituicao', 'sql_alias' => 'i.inst_cod', 'alias' => 'un', 'value' => '' ], 'opened_by' => [ 'label' => TRANS('OPENED_BY'), 'table' => 'usuarios', 'field_id' => 'user_id', 'field_name' => 'nome', 'table_reference' => 'ocorrencias', 'table_reference_alias' => 'o', 'field_reference' => 'aberto_por', 'sql_alias' => 'o.aberto_por', 'alias' => 'ua', 'value' => '' ], 'authorization_status' => [ 'label' => TRANS('AUTHORIZATION_STATUS'), 'table' => 'authorization_status', 'field_id' => 'id', 'field_name' => 'name_key', 'table_reference' => 'ocorrencias', 'table_reference_alias' => 'o', 'field_reference' => 'authorization_status', 'sql_alias' => 'o.authorization_status', 'alias' => 'aus', 'value' => '' ] ]; if (!empty($post)) { /* Níveis possíveis de agrupamento */ $groups = [ 'group_1' => '', 'group_2' => '', 'group_3' => '', 'group_4' => '', 'group_5' => '', ]; foreach ($groups as $key => $group) { if (!empty($post[$key])) { $groups[$key] = $post[$key]; } else { unset($groups[$key]); } } $table_id = $post['params']; $params = []; if (isset($post['params']) && !empty($post['params'])) { /* Tratamento quando o último parâmetro for de valor nulo */ if (substr($post['params'], -1) == '-') { $post['params'] .= '0'; } $params = explode('--', str_replace('---','-0--', $post['params'])); } $tmp = []; /** Adicionando o valor para pesquisa no array principal $options */ foreach ($params as $param) { $tmp = explode('-' , $param); $options[$tmp[0]]['value'] = (array_key_exists(1, $tmp) ? $tmp[1] : '0'); } /* Monta os termos de pesquisa para a consulta SQL que exibirá a tabela de chamados */ $sql_terms = ""; foreach ($options as $key => $value) { if ($value['value'] !== '') { $sql_terms .= ($value['value'] == 0 ? "AND {$value['sql_alias']} IS NULL " : "AND {$value['sql_alias']}={$value['value']} "); } } /* Chamado mais antigo em aberto */ $ticketStart = getOlderTicketInProgress($conn); $ticketInfo = getTicketData($conn, $ticketStart, ['data_abertura']); $terms = (!empty($ticketInfo['data_abertura']) ? " o.data_abertura >= '{$ticketInfo['data_abertura']}' AND " : ""); $sql = $QRY["tickets_in_queues"] . " AND {$terms} -- s.stat_ignored <> 1 AND -- s.stat_painel in (1,2) AND s.not_done = 1 AND o.sistema IN ({$uareas}) {$sql_terms} "; /* Só enviará dados se for o último nível do agrupamento selecionado */ if (count($params) == count($groups)) { try { $res = $conn->query($sql); ?>
| = TRANS('NUMBER_ABBREVIATE'); ?> / = TRANS('AREA'); ?> | = TRANS('ISSUE_TYPE'); ?> | = TRANS('CLIENT'); ?> = TRANS('CONTACT'); ?> = TRANS('DEPARTMENT'); ?> |
= TRANS('REQUESTER_AREA'); ?> = TRANS('DESCRIPTION'); ?> |
= TRANS('OPENING_DATE'); ?> | = TRANS('ABSOLUTE_TIME'); ?> | = TRANS('COL_STATUS'); ?> | = TRANS('COL_PRIORITY'); ?> | = TRANS('COL_SLAS'); ?> |
|---|---|---|---|---|---|---|---|---|
| = $lastEntryNotification; ?>)>= $rowDetail['numero']; ?>= $imgSub; ?> = $rowDetail['area']; ?> |
= $linkImg; ?> = $rowDetail['problema']; ?> | = $clientName; ?>= $rowDetail['contato']; ?> = $departmentName; ?> |
= $rowDetail['area_solicitante']; ?> = $texto; ?> |
= dateScreen($rowDetail['data_abertura']); ?> | = $absoluteTime['inTime']; ?> | = $renderTicketStatus; ?> | = "" . $rowDetail['pr_descricao'] . ""; ?> | = " |