From f279887d7e9d1be73e58984e645935ecaec6de06 Mon Sep 17 00:00:00 2001 From: Kaya84 <35736369+Kaya84@users.noreply.github.com> Date: Fri, 19 Nov 2021 09:26:41 +0100 Subject: [PATCH] Create hook.php --- hook.php | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 hook.php diff --git a/hook.php b/hook.php new file mode 100644 index 0000000..9a4b591 --- /dev/null +++ b/hook.php @@ -0,0 +1,60 @@ +. + -------------------------------------------------------------------------- +*/ + +function plugin_remotesupport_install(){ + return true; +} + +function plugin_remotesupport_uninstall(){ + return true; +} + +function plugin_remotesupport_postinit() { + global $CFG_GLPI, $DB; + + if(isset($_GET['id']) && $_GET['id'] != 0 && isset($_GET['_itemtype']) && $_GET['_itemtype'] == "Ticket"){ + $id = $_GET['id']; + + //mysql> select * from glpi_tickets_users where tickets_id = 2 and type = 1; + + $req = $DB->request(['FROM' => 'glpi_tickets_users', 'WHERE' => ['tickets_id' => $id, 'type' => 1]]); + //NB: Estraggo unicamente il primo richiedente + $row = $req->next(); + $requester = $row['users_id']; + // select id, name, users_id from glpi_computers where users_id = 178; + + $req2 = $DB->request(['FROM' => 'glpi_computers', 'WHERE' => ['users_id' => $requester]]); + $url = ""; + + while ($row2 = $req2->next()){ + $url .= "