From fdf26bf59658c5ffadffffa12083fa8ecdceae9b Mon Sep 17 00:00:00 2001
From: MC-brunomendes <42571547+MC-brunomendes@users.noreply.github.com>
Date: Fri, 19 Nov 2021 16:51:33 +0000
Subject: [PATCH 1/2] Update hook.php
---
hook.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hook.php b/hook.php
index 9a4b591..d31f44b 100644
--- a/hook.php
+++ b/hook.php
@@ -47,7 +47,7 @@ function plugin_remotesupport_postinit() {
$url = "";
while ($row2 = $req2->next()){
- $url .= "
" . $row2['name'] . "";
+ $url .= "" . $row2['name'] . "";
}
if ($url != ""){
From ce8b814182333fefc887d8686f3794418173856f Mon Sep 17 00:00:00 2001
From: MC-brunomendes <42571547+MC-brunomendes@users.noreply.github.com>
Date: Fri, 19 Nov 2021 17:19:25 +0000
Subject: [PATCH 2/2] Update hook.php
If the user doesn't exists on database it doesn't show anything
---
hook.php | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/hook.php b/hook.php
index d31f44b..9e7ce8b 100644
--- a/hook.php
+++ b/hook.php
@@ -43,18 +43,19 @@ function plugin_remotesupport_postinit() {
$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 .= "" . $row2['name'] . "";
- }
-
- if ($url != ""){
- echo "Remote support :
";
- echo $url;
- echo "
";
- }
+ if ($row['users_id'] != 0) {
+ $req2 = $DB->request(['FROM' => 'glpi_computers', 'WHERE' => ['users_id' => $requester]]);
+ $url = "";
+
+ while ($row2 = $req2->next()){
+ $url .= "Remote support :
";
+ echo $url;
+ echo "
";
+ }
+ }
}
}
?>