-
-
Save renatoschroepfer/18c527ed05bbbc90e005358b951d65b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create ticket | |
if (Session::haveRight("ticket", CREATE)) { | |
$menu['create_ticket']['id'] = "menu2"; | |
/* Isaac Costa - Custom - Restrição de abertura de chamado (com a colaboração de Renato Lázaro e Ana Costa) */ | |
$usuarioIDString = Session::getLoginUserID(); | |
$usuarioID = (int)$usuarioIDString; | |
$conectaGLPI = mysqli_connect("localhost", "root", "Luk3Skyw@lk3r") or print (mysqli_error()); /* Isaac Costa - Custom - Substituir SERVIDOR, USUARIO e SENHA pelos dados de conexão ao banco do GLPI*/ | |
mysql_select_db("glpi", $conectaGLPI) or print(mysqli_error()); /* Isaac Costa - Custom - Substituir BANCO pelo banco de dados utilizado pelo GLPI*/ | |
$sql = "select count(*) from glpi_ticketsatisfactions S inner join glpi_tickets T on S.tickets_id = T.id inner join glpi_users U on T.users_id_lastupdater = U.id | |
where T.status = 6 and S.date_begin is not null and S.date_answered is null and U.id = {$usuarioID}"; | |
$res = mysqli_query($sql); | |
$countSatisfaction = mysqli_fetch_assoc($res); | |
$contSatisfacao = (int) end($countSatisfaction); | |
$quantidadeLimiteSatisfacao = 2 ; /* Isaac Costa - Aqui inserimos o limite de chamados que podem existir sem pesquisa de satisfação respondida para o usuário */ | |
if ($contSatisfacao > $quantidadeLimiteSatisfacao) { | |
$menu['create_ticket']['default'] = '/front/helpdesk.public.php'; | |
} | |
else { | |
$menu['create_ticket']['default'] = '/front/helpdesk.public.php?create_ticket=1'; | |
} | |
/* Isaac Costa - Custom - Restrição de abertura de chamado (com a colaboração de Renato Lázaro e Ana Costa) */ | |
$menu['create_ticket']['title'] = __s('Create a ticket'); | |
$menu['create_ticket']['content'] = array(true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment