top.window.location = '../../ocomon/open_form/ticket_show_global.php?numero=" . $numero . "&id=" . $gtID . "'"; exit; } elseif (!isset($_SESSION['s_logado']) || $_SESSION['s_logado'] == 0) { $_SESSION['session_expired'] = 1; echo ""; exit; } $auth = new AuthNew($_SESSION['s_logado'], $_SESSION['s_nivel'], 3, 1); $config = getConfig($conn); $mailConfig = getMailConfig($conn); /* Se é próprio solicitante */ $isRequester = false; $isResponsible = false; ?> <?= APP_NAME; ?> <?= VERSAO; ?> query($query); $row = $resultado->fetch(); $GLOBALACCESS = false; /* Se não for o próprio usuário que abriu o chamado */ if ($_SESSION['s_uid'] != $row['aberto_por_cod']) { /* Checa se tem o link global da ocorrência */ if (isset($_GET['id']) && !empty($_GET['id'])) { $gtID = str_replace(" ", "+", $_GET['id']); if ($gtID == getGlobalTicketId($conn, $row['numero'])) $GLOBALACCESS = true; } /* Checa se é admin da área */ if ($_SESSION['s_nivel'] == 3 && !$GLOBALACCESS) { if (!$_SESSION['s_area_admin'] || $_SESSION['s_area'] != $row['aberto_por_area']) { echo message('danger', 'Ooops!', TRANS('MSG_NOT_ALLOWED'), '', '', true); exit; } } } else { $isRequester = true; } /* Se é o usuário que está marcado como operador do chamado */ if ($row['operador_cod'] == $_SESSION['s_uid']) { $isResponsible = true; } /* Checagem para saber se o usuário logado pode tratar o chamado (edição e encerramento) */ $allowTreat = false; if ($_SESSION['s_nivel'] != 1) { if ($_SESSION['s_nivel'] > 2) { /* Somente-abertura não pode tratar */ $allowTreat = false; } elseif ($isRequester && !$config['conf_allow_op_treat_own_ticket']) { /* Se for operador solicitante, então depende da configuração sobre se o usuário operador pode tratar chamados abertos por ele mesmo*/ $allowTreat = false; } else { $allowTreat = true; } } else { /* Admin sempre pode tratar */ $allowTreat = true; } /* Informações estendidas do chamado caso tenha sido gerado orçamento */ $ticketExtendedInfo = getTicketInvoiceInfo($conn, $COD); $hasInvoice = (!empty($ticketExtendedInfo)); /* ASSENTAMENTOS */ // if ($_SESSION['s_nivel'] < 3) { if ($allowTreat) { $query2 = "select a.*, u.* from assentamentos a, usuarios u where a.responsavel=u.user_id and a.ocorrencia=" . $COD . ""; } else $query2 = "select a.*, u.* from assentamentos a, usuarios u where a.responsavel=u.user_id and a.ocorrencia=" . $COD . " and a.asset_privated = 0"; $resultAssets = $conn->query($query2); $assentamentos = $resultAssets->rowCount(); /* CHECA SE A OCORRÊNCIA É SUB CHAMADO */ $sqlPai = "select * from ocodeps where dep_filho = " . $COD . " "; $execpai = $conn->query($sqlPai); $rowPai = $execpai->fetch(); if ($rowPai && $rowPai['dep_pai'] != "") { $msgPai = "
"; } else $msgPai = ""; /* Checagem para identificar chamados relacionados */ $qrySubCall = "SELECT * FROM ocodeps WHERE dep_pai = {$COD} OR dep_filho = {$COD}"; $execSubCall = $conn->query($qrySubCall); $existeSub = $execSubCall->rowCount(); /* INÍCIO DAS CHECAGENS PARA A MONTAGEM DO MENU DE OPÇÕES */ $showItemClosure = false; $showItemEdit = false; $showItemAttend = false; $showItemOpenSubcall = false; $showItemReopen = false; $showItemPrint = true; $showItemSla = true; $showItemDocTime = false; /* Essa função será removida - pouca utilidade e muito onerosa */ $showItemSendMail = false; $showItemHistory = true; $showItemSchedule = false; $itemClosure = ""; $itemEdit = ""; $itemAttend = ""; $itemOpenSubcall = ""; $itemReopen = ""; $itemPrint = "print_ticket.php?numero=" . $row['numero']; /* TRANS('FIELD_PRINT_OCCO') */ $itemSla = "mostra_sla_definido.php?popup=true&numero=" . $row['numero']; /* TRANS('COL_SLA') */ $itemDocTime = "tempo_doc.php?popup=true&cod=" . $row['numero']; /* TRANS('FIELD_TIME_DOCUMENTATION') */ $itemSendMail = ""; $itemHistory = "ticket_history.php?numero=" . $row['numero']; // if ($row['status_cod'] != 4 && $_SESSION['s_nivel'] < 3) { if ($row['status_cod'] != 4 && $allowTreat) { $showItemClosure = true; $itemClosure = "ticket_close.php?numero=" . $row['numero']; //TRANS('CLOSE_TICKET') $showItemSchedule = true; } // if ($_SESSION['s_nivel'] < 3) { if ($allowTreat) { $showItemEdit = true; $itemEdit = "ticket_edit.php?numero=" . $row['numero']; /* TRANS('BT_EDIT') */ } // if (($row['status_cod'] != 2) && ($row['status_cod'] != 4) && ($_SESSION['s_nivel'] < 3)) { if (($row['status_cod'] != 2) && ($row['status_cod'] != 4) && ($allowTreat)) { $showItemAttend = true; } // if ($row['status_cod'] != 4 && $_SESSION['s_nivel'] < 3) { if ($row['status_cod'] != 4 && $allowTreat) { $showItemOpenSubcall = true; // $itemOpenSubcall = "ticket_add.php?popup=true&pai=" . $row['numero'] . "&invTag=" . $row['etiqueta'] . "&invInst=" . $row['unidade_cod'] . "&invLoc=" . $row['setor_cod'] . "&contato=" . $row['contato'] . "&telefone=" . $row['telefone']; $itemOpenSubcall = "ticket_add.php?pai=" . $row['numero']; /* TRANS('TO_OPEN_SUBTICKET') */ } /** * Só permite reabertura para o usuário solicitante ou operador técnico (do próprio chamado) * dentro do prazo limite pós encerramento */ if ($row['status_cod'] == 4 && $config['conf_allow_reopen'] && ($isRequester || $isResponsible)) { /* Checar o limite de tempo */ if ($config['conf_reopen_deadline']) { $date1 = new DateTime($row['data_fechamento']); $date2 = new DateTime(); if ($date1->diff($date2)->days <= $config['conf_reopen_deadline']) { $showItemReopen = true; } else { $showItemReopen = false; } } else { $showItemReopen = true; } } // if ($_SESSION['s_nivel'] < 3 && $mailConfig['mail_send']) { if ($allowTreat && $mailConfig['mail_send']) { $showItemSendMail = true; $itemSendMail = "form_send_mail.php?popup=true&numero=" . $row['numero']; /* TRANS('SEND_EMAIL') */ } /* final das chegagens para a montagem do menu de opções */ /* INÍCIO DAS CONSULTAS REFERENTES À OCORRÊNCIA */ $isClosed = ($row['status_cod'] == 4 ? true : false); $isScheduled = ($row['oco_scheduled'] == 1 ? true : false); $qryCatProb = "SELECT * FROM problemas as p " . "LEFT JOIN sla_solucao as sl on sl.slas_cod = p.prob_sla " . "LEFT JOIN prob_tipo_1 as pt1 on pt1.probt1_cod = p.prob_tipo_1 " . "LEFT JOIN prob_tipo_2 as pt2 on pt2.probt2_cod = p.prob_tipo_2 " . "LEFT JOIN prob_tipo_3 as pt3 on pt3.probt3_cod = p.prob_tipo_3 " . " WHERE p.prob_id = " . $row['prob_cod'] . " "; $execCatprob = $conn->query($qryCatProb); $rowCatProb = $execCatprob->fetch(); $descricao = ""; if (isset($_GET['destaca'])) { $descricao = destaca($_GET['destaca'], toHtml(nl2br($row['descricao']))); } else { $descricao = toHtml(nl2br($row['descricao'])); } $ShowlinkScript = ""; $qryScript = "SELECT * FROM prob_x_script WHERE prscpt_prob_id = " . $row['prob_cod'] . ""; $execQryScript = $conn->query($qryScript); if ($execQryScript->rowCount() > 0) // $ShowlinkScript = ""; $ShowlinkScript = ""; $global_link = getGlobalUri($conn, $_GET['numero']); // $dateOpen = formatDate($row['data_abertura']); $dateOpen = (!empty($row['oco_real_open_date'] && $row['oco_real_open_date'] != '0000-00-00 00:00:00') ? formatDate($row['oco_real_open_date']) : formatDate($row['data_abertura'])); $dateClose = formatDate($row['data_fechamento']); $dateLastSchedule = formatDate($row['oco_scheduled_to']); $dateScheduleTo = ""; $timeScheduleTo = ""; $dateRealOpen = formatDate($row['oco_real_open_date']); $scriptSolution = ""; if ($isClosed) { if ($row['data_abertura'] != $row['oco_real_open_date'] && $row['oco_real_open_date'] != '0000-00-00 00:00:00') { $dateLastSchedule = formatDate($row['data_abertura']); $dateClose = formatDate($row['data_fechamento']); $dateRealOpen = formatDate($row['oco_real_open_date']); } else { // $dateOpen = formatDate($row['data_abertura']); $dateOpen = (!empty($row['oco_real_open_date'] && $row['oco_real_open_date'] != '0000-00-00 00:00:00') ? formatDate($row['oco_real_open_date']) : formatDate($row['data_abertura'])); $dateClose = formatDate($row['data_fechamento']); } $scriptSolution = $row['script_desc']; } else { if ($isScheduled) { // $dateOpen = formatDate($row['data_abertura']); $dateOpen = (!empty($row['oco_real_open_date'] && $row['oco_real_open_date'] != '0000-00-00 00:00:00') ? formatDate($row['oco_real_open_date']) : formatDate($row['data_abertura'])); // $dateScheduleTo = formatDate($row['oco_scheduled_to']); $dateScheduleTo = dateScreen($row['oco_scheduled_to'], 0, 'd/m/Y H:i'); $timeScheduleTo = explode(" ", $row['oco_scheduled_to'])[1]; } else { // $dateOpen = formatDate($row['data_abertura']); $dateOpen = (!empty($row['oco_real_open_date'] && $row['oco_real_open_date'] != '0000-00-00 00:00:00') ? formatDate($row['oco_real_open_date']) : formatDate($row['data_abertura'])); // $dateScheduleTo = formatDate($row['oco_scheduled_to']); } if ($row['data_abertura'] != $row['oco_real_open_date'] && $row['oco_real_open_date'] != '0000-00-00 00:00:00' && !empty($row['oco_real_open_date'])) { $dateLastSchedule = formatDate($row['data_abertura']); $dateRealOpen = formatDate($row['oco_real_open_date']); } } $qryMail = "SELECT * FROM mail_hist m, usuarios u WHERE m.mhist_technician=u.user_id AND m.mhist_oco=" . $COD . " ORDER BY m.mhist_date"; $execMail = $conn->query($qryMail); $emails = $execMail->rowCount(); $sqlFiles = "select * from imagens where img_oco = " . $COD . ""; $resultFiles = $conn->query($sqlFiles); $hasFiles = $resultFiles->rowCount(); /* FINAL DAS CONSULTAS REFERENTES À OCORRÊNCIA */ $colLabel = "col-sm-3 text-md-right font-weight-bold p-2"; $colsDefault = "small text-break border-bottom rounded p-2 bg-white"; /* border-secondary */ $colContent = $colsDefault . " col-sm-3 col-md-3"; $colContentLine = $colsDefault . " col-sm-9"; $colContentLineFile = " text-break border-bottom rounded p-2 bg-white col-sm-9"; $ticketAuxWorkers = getTicketWorkers($conn, $COD, 2); $selectAuxWorkers = []; if (!empty($ticketAuxWorkers)) { foreach ($ticketAuxWorkers as $aux) { $selectAuxWorkers[] = $aux['user_id']; } } $selectAuxWorkersJs = json_encode($selectAuxWorkers); ?>
">
">
" . TRANS("SATS") . " " . $worktimeSets['sat']; $renderWtSets .= "
" . TRANS("SUNS") . " " . $worktimeSets['sun']; $renderWtSets .= "
" . TRANS("MNL_FERIADOS") . " " . $worktimeSets['off']; } ?>
" . $aux['nome']. ""; } } ?>
" . $row['pr_descricao'] . ""; ?>

'; } elseif ($field['field_type'] == 'textarea') { $isTextArea = true; } $col = ($col > $number_of_collumns ? 1 : $col); if ($col == 1) { ?>
0 ? '' : ' disabled'); $ariaDisabledAssent = ($assentamentos > 0 ? '' : ' true'); $classDisabledEmails = ($emails > 0 ? '' : ' disabled'); $ariaDisabledEmails = ($emails > 0 ? '' : ' true'); $classDisabledFiles = ($hasFiles > 0 ? '' : ' disabled'); $ariaDisabledFiles = ($hasFiles > 0 ? '' : ' true'); $classDisabledSubs = ($existeSub > 0 ? '' : ' disabled'); $ariaDisabledSubs = ($existeSub > 0 ? '' : ' true'); ?>
fetchAll() as $rowAsset) { $transAssetText = ""; if ($rowAsset['asset_privated'] == 1) { $transAssetText = "" . TRANS('CHECK_ASSET_PRIVATED') . ""; } else { $transAssetText = "" . TRANS('CHECK_ASSET_PUBLIC') . ""; } /* Badge da primeira resposta */ $badgeFirstResponse = ""; if (!empty($row['data_atendimento']) && $row['data_atendimento'] == $rowAsset['data']) { $badgeFirstResponse = ' ' . TRANS('FIRST_RESPONSE') . ''; } ?>
#
fetchAll() as $rowMail) { $limite = 30; $shortBody = trim($rowMail['mhist_body']); if (strlen($shortBody) > $limite) { $shortBody = substr($shortBody, 0, ($limite - 4)) . "..."; } ?>
#
fetchAll() as $rowFiles) { $size = round($rowFiles['img_size'] / 1024, 1); $rowFiles['img_tipo'] . "](" . $size . "k)"; if (isImage($rowFiles["img_tipo"])) { /* $viewImage = " "; */ $viewImage = " "; /* $page = "../../includes/functions/showImg.php?file=" . $row['numero'] . "&cod=" . $rowFiles['img_cod']; $viewImage = " "; */ } else { $viewImage = ""; } ?>
#
k
fetchAll() as $rowSubPai) { // $sqlStatus = "select o.*, s.* from ocorrencias o, `status` s where o.numero=" . $rowSubPai['dep_filho'] . " and o.`status`=s.stat_id and s.stat_painel not in (3) "; // $execStatus = $conn->query($sqlStatus); // $regStatus = $execStatus->rowCount(); // if ($regStatus > 0) { // $comDeps = true; // } // if ($comDeps) { // $imgSub = ICONS_PATH . "view_tree_red.png"; // } else { // $imgSub = ICONS_PATH . "view_tree_green.png"; // } $key = $rowSubPai['dep_filho']; $label = "" . TRANS('CHILD_TICKET') . ""; // $comDeps = false; if ($rowSubPai['dep_pai'] != $COD) { $key = $rowSubPai['dep_pai']; $label = "" . TRANS('PARENT_TICKET') . ""; } $qryDetail = $QRY["ocorrencias_full_ini"] . " WHERE o.numero = " . $key . " "; $execDetail = $conn->query($qryDetail); $rowDetail = $execDetail->fetch(); $texto = trim($rowDetail['descricao']); if (strlen($texto) > 200) { $texto = substr($texto, 0, 195) . " ..... "; }; ?>
" . TRANS('COL_PHONE'); ?> " . TRANS('DESCRIPTION'); ?> " . TRANS('COL_STATUS'); ?>
  " . $rowDetail['telefone']; ?> " . $texto; ?> " . $rowDetail['chamado_status']; ?>