Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLPI 11 Compatibility #44

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix phpstan error
Lainow committed Feb 20, 2025
commit ec6cef2eb6b2a3ae97d9a26b4c1516662b23d35c
2 changes: 1 addition & 1 deletion ajax/agent.php
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@
if (isset($_POST['action']) && isset($_POST['id'])) {
$agent = new Agent();
if (!$agent->getFromDB($_POST['id'])) {
throw new \Glpi\Exception\Http\NotFoundHttpException('Unable to load agent #' . $_POST['id']);
throw new \Glpi\Exception\Http\NotFoundHttpException();
};
$answer = [];

16 changes: 10 additions & 6 deletions inc/inventoryaction.class.php
Original file line number Diff line number Diff line change
@@ -112,13 +112,14 @@ public static function runPartialInventory(Agent $agent, $fromMA = false)
// not authorized
return self::handleAgentResponse($response, $endpoint);
}
} catch (Exception $e) {
}
if ($fromMA) {
return false;
} else {
// not authorized
return ['answer' => __('Not allowed')];
}

if ($fromMA) {
return false;
} else {
// not authorized
return ['answer' => $e->getMessage()];
}
}

@@ -169,6 +170,9 @@ public static function postItemForm($item)
return;
}

/** @var array $CFG_GLPI */
global $CFG_GLPI;

if ($item::getType() == Computer::getType()) {
if ($agent = self::findAgent($item)) {
$out = '<div class="mb-3 col-12 col-sm-6">';
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ parameters:
scanDirectories:
- ../../src
- ../../inc
- ../../vendor/symfony/http-kernel/Exception
stubFiles:
- ../../stubs/glpi_constants.php
rules: