Commit 70cb6e2d authored by Johan Cwiklinski's avatar Johan Cwiklinski Committed by Johan Cwiklinski

Fix flash messages from old method

parent 971dbe61
......@@ -154,7 +154,7 @@ jobs:
- run:
name: PHP CS
command: |
vendor/bin/phpcs -d memory_limit=512M -p -n --extensions=php --standard=PSR2 ./src ./public/index.php && vendor/bin/phpcs -d memory_limit=512M -p --extensions=php --standard=vendor/glpi-project/coding-standard/GlpiStandard/ --ignore=/.git,/config,/files,/lib,/node_modules,/plugins,/src,/tests/config,/vendor ./
vendor/bin/phpcs -d memory_limit=512M -p -n --extensions=php --standard=PSR2 ./src ./public/index.php && vendor/bin/phpcs -d memory_limit=512M -p --extensions=php --standard=vendor/glpi-project/coding-standard/GlpiStandard/ --ignore=/.git,/config,/files,/lib,/node_modules,/plugins,/src,/tests/config,/vendor,/public/index.php ./
- run:
name: ESLint
command: |
......
......@@ -618,8 +618,14 @@ class MailCollector extends CommonDBTM {
$this->close_mailbox(); //Close Mail Box
//TRANS: %1$d, %2$d, %3$d, %4$d and %5$d are number of messages
$msg = sprintf(__('Number of messages: available=%1$d, retrieved=%2$d, refused=%3$d, errors=%4$d, blacklisted=%5$d'),
$tot, $this->fetch_emails, $refused, $error, $blacklisted);
$msg = sprintf(
__('Number of messages: available=%1$d, retrieved=%2$d, refused=%3$d, errors=%4$d, blacklisted=%5$d'),
$tot,
$this->fetch_emails,
$refused,
$error,
$blacklisted
);
if ($display) {
Session::addMessageAfterRedirect($msg, false, ($error ? ERROR : INFO));
} else {
......
......@@ -1082,22 +1082,20 @@ class Session {
|| !isset($array[$message_type])
|| in_array($msg, $array[$message_type]) === false) {
array_push($array[$message_type], $msg);
global $IS_TWIG, $container;
if ($IS_TWIG) {
switch ($message_type) {
case ERROR:
$flashtype = 'error';
break;
case WARNING:
$flashtype = 'warniing';
break;
case INFO:
default:
$flashtype = 'info';
break;
}
$container->get(Slim\Flash\Messages::class)->addMessage($flashtype, $msg);
global $CONTAINER;
switch ($message_type) {
case ERROR:
$flashtype = 'error';
break;
case WARNING:
$flashtype = 'warning';
break;
case INFO:
default:
$flashtype = 'info';
break;
}
$CONTAINER->get(Slim\Flash\Messages::class)->addMessage($flashtype, $msg);
}
}
}
......
......@@ -69,7 +69,6 @@ if (!file_exists(GLPI_CONFIG_DIR . "/db.yaml") && !file_exists(GLPI_CONFIG_DIR .
//handle redirections from old ui
if (isset($_GET['uiredirect'])) {
var_dump($_GET);
$params = [];
$route = null;
foreach ($_GET as $key => $param) {
......
......@@ -985,7 +985,7 @@ class Main extends AbstractController implements ControllerInterface
return $response->withRedirect($redirect_uri, 302);
}
$this->flash->addMessage(__('Unable to load requested saved search!'));
$this->flash->addMessage('error', __('Unable to load requested saved search!'));
return $response->withRedirect($this->router->getBasePath(), 500);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment