query($query);
$row = $resultado->fetch();
$query2 = "SELECT a.*, u.* FROM assentamentos a LEFT JOIN usuarios u ON u.user_id = a.responsavel WHERE a.ocorrencia = {$numero} 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 = " . $numero . " ";
$execpai = $conn->query($sqlPai);
$rowPai = $execpai->fetch();
if ($rowPai && $rowPai['dep_pai'] != "") {
$msgPai = TRANS('FIELD_OCCO_SUB_CALL') . "
";
} else
$msgPai = "";
/* Checagem para identificar chamados relacionados */
$qrySubCall = "SELECT * FROM ocodeps WHERE dep_pai = {$numero} OR dep_filho = {$numero}";
$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 = "../geral/print_ticket.php?numero=" . $numero . "&id=" . $id; /* TRANS('FIELD_PRINT_OCCO') */
$itemSendMail = "";
$itemHistory = "ticket_history.php?numero=" . $row['numero'];
/* INÍCIO DAS CONSULTAS REFERENTES À OCORRÊNCIA */
$isClosed = ($row['status_cod'] == 4 ? true : false);
$isScheduled = ($row['oco_scheduled'] == 1 ? true : false);
$ratedInfo = getRatedInfo($conn, $numero);
$isDoneStatus = ($row['status_cod'] == $config['conf_status_done']);
// $isRejected = (!empty($ratedInfo) && empty($ratedInfo['rate']) && !$isDoneStatus);
$isRejected = isRejected($conn, $row['numero']);
$isRequester = false;
$showApprovalOption = false;
/**
* Definirá se o chamado poderá ser avaliado nessa tela
*/
$canBeRated = false;
$isRated = isRated($conn, $numero);
if (!empty($rating_id) && asEquals($rating_id, getGlobalTicketRatingId($conn, $numero))) {
/* Se foi passado o rating_id corretamente, significa que o usuário possui o link para avaliação, pontanto, solicitante */
$isRequester = true;
/* Checar o limite de tempo para a validacao do atendimento */
if (!empty($row['data_fechamento'])) {
$deadlineToApprove = addDaysToDate($row['data_fechamento'], $config['conf_time_to_close_after_done'], $onlyBusinessDays);
/* if (daysFromDate($row['data_fechamento']) <= $config['conf_time_to_close_after_done']) {
$showApprovalOption = ($isRequester && !$isResponsible && !$isRated ? true : false);
$canBeRated = (!$isRated ? true : false);
} */
if (date('Y-m-d H:i:s') < $deadlineToApprove) {
if ($isDoneStatus) {
$showApprovalOption = ($isRequester && !$isRated ? true : false);
$canBeRated = (!$isRated ? true : false);
}
}
}
}
// if ($showApprovalOption) {
// $itemClosure = " onClick=\"approvingTicket({$numero})\"";
// }
$issueDetails = (!empty($row['prob_cod'] && $row['prob_cod'] != '-1') ? getIssueDetailed($conn, $row['prob_cod'])[0] : []);
$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 = "
";
$global_link = getGlobalUri($conn, $numero);
$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 = (!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 = (!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 = dateScreen($row['oco_scheduled_to'], 0, 'd/m/Y H:i');
$timeScheduleTo = explode(" ", $row['oco_scheduled_to'])[1];
} else {
$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']));
}
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=" . $numero . " ORDER BY m.mhist_date";
$execMail = $conn->query($qryMail);
$emails = $execMail->rowCount();
$sqlFiles = "select * from imagens where img_oco = " . $numero . "";
$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";
?>
= TRANS('CLIENT'); ?>
= $client['nickname'] ?>
$ticket_rate['rate'] ?? null,
// 'isDoneStatus' => $isDoneStatus,
// 'isRequester' => $isRequester,
// 'isRejected' => $isRejected
// ]);
?>
= TRANS('SERVICE_RATE'); ?>
= renderRate($ticket_rate['rate'] ?? null, $isDoneStatus, $isRequester, $isRejected, 'rate-your-ticket'); ?>
= TRANS('OPENED_BY'); ?>
= noHtml($row['aberto_por']); ?>
= TRANS('DEPARTMENT'); ?>
= noHtml($row['setor']); ?>
" . TRANS("SATS") . " " . $worktimeSets['sat'];
$renderWtSets .= "
" . TRANS("SUNS") . " " . $worktimeSets['sun'];
$renderWtSets .= "
" . TRANS("MNL_FERIADOS") . " " . $worktimeSets['off'];
}
?>
= TRANS('REQUESTER_AREA'); ?>
= noHtml($row['area_solicitante']); ?>
= TRANS('RESPONSIBLE_AREA'); ?>
= noHtml($row['area']); ?>
= TRANS('ISSUE_TYPE'); ?>
= noHtml($row['problema']) . " " . $ShowlinkScript; ?>
= TRANS('COL_CAT_PROB'); ?>
$catKey) {
if (!empty($issueDetails[$catKey]) && strlen($issueDetails[$catKey]) > 1) {
$arrayCategories[] = $groupNames[$key] . ": " . $issueDetails[$catKey];
}
}
$categories = implode(",", $arrayCategories);
?>
= strToTags($categories, 0, "secondary", "issue-category"); ?>
= TRANS('DESCRIPTION'); ?>
= $descricao; ?>
= TRANS('INPUT_TAGS'); ?>
= strToTags($row['oco_tag']); ?>
" . $row['pr_descricao'] . "";
?>
= TRANS('OCO_PRIORITY'); ?>
= $priorityBadge; ?>
= TRANS('OPENING_CHANNEL'); ?>
= $channel['name'] ?? ''; ?>
= TRANS('COL_UNIT'); ?>
= noHtml($row['unidade']); ?>
= TRANS('FIELD_TAG_EQUIP'); ?>
= noHtml($row['etiqueta']); ?>
= TRANS('CONTACT'); ?>
= noHtml($row['contato']); ?>
= TRANS('COL_PHONE'); ?>
= noHtml($row['telefone']); ?>
= TRANS('CONTACT_EMAIL'); ?>
= noHtml($row['contato_email']); ?>
= TRANS('OPENING_DATE'); ?>
= noHtml($dateOpen); ?>
= TRANS('FIELD_SCHEDULE_TO'); ?>
= $dateScheduleTo; ?>
= TRANS('FIELD_DATE_CLOSING'); ?>
= noHtml($dateClose); ?>
= TRANS('COL_SCRIPT_SOLUTION'); ?>
= noHtml($scriptSolution); ?>
" . $row['chamado_status'] . "";
?>
= TRANS('COL_STATUS'); ?>
= $statusBadge; ?>
= TRANS('REGISTRATION_AUTHOR'); ?>
= noHtml($registratorInfo['nome']); ?>
= TRANS('OCO_RESP'); ?>
= $ticketTreaterInfo['nome']; ?>
= TRANS('GLOBAL_LINK'); ?>
= $global_link; ?>
$field) {
if (!empty($hiddenCustomFields) && in_array($field['field_id'], $hiddenCustomFields)) {
unset($custom_fields[$key]);
}
}
}
$number_of_collumns = 2;
if (count($custom_fields) && !empty($custom_fields[0]['field_id'])) {
?>
= TRANS('EXTRA_FIELDS'); ?>
';
}
$col = ($col > $number_of_collumns ? 1 : $col);
if ($col == 1) {
?>
= $field['field_label']; ?>
= $field_value; ?>
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');
?>