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 .= "