Skip to content
Draft
Show file tree
Hide file tree
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
Next Next commit
wip, fix some usages.
  • Loading branch information
SebSept committed Oct 23, 2025
commit 61a22d98fb026c9b40f4dce99206537f8538d84e
10 changes: 9 additions & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,15 @@ public function prepareInputForUpdate($input)

$input = array_filter($input, fn($key) => !in_array($key, $values_to_filter), ARRAY_FILTER_USE_KEY);

static::setConfigurationValues('core', $input);
try {
static::setConfigurationValues('core', $input);
} catch (Exception $e) {
Session::addMessageAfterRedirect(
'Error saving configuration: ' . htmlentities($e->getMessage()),
false,
ERROR
);
}

return false;
}
Expand Down
19 changes: 16 additions & 3 deletions src/GLPINetwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,23 @@ public static function getIcon()

public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
{
if ($item::class === Config::class) {
self::showForConfig();
try {
if ($item->getType() == 'Config') {
$glpiNetwork = new self();
$glpiNetwork->showForConfig();
Comment on lines +57 to +58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$glpiNetwork = new self();
$glpiNetwork->showForConfig();
self::showForConfig();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intented to have the less possible changes, but I can change it if it hurt your eyes 😆

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only just because it is a static method and should be called statically.

}
return true;
} catch (Exception $e) {
TemplateRenderer::getInstance()->display(
'/central/messages.html.twig',
[
'messages' => [
'errors' => [$e->getMessage()],
],
]
);
return false;
}
return true;
}

public static function showForConfig()
Expand Down