diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php
index 11822eb47a2..c2d6d2a7d79 100644
--- a/htdocs/admin/modulehelp.php
+++ b/htdocs/admin/modulehelp.php
@@ -350,8 +350,6 @@ if ($mode == 'desc') {
$text .= '
'.$langs->trans("IdModule").': '.$objMod->numero;
- $text .= '
'.$langs->trans("Version").': '.$version;
-
$textexternal = '';
if ($objMod->isCoreOrExternalModule() == 'external') {
$tmpdirofmoduletoshow = preg_replace('/^'.preg_quote(DOL_DOCUMENT_ROOT, '/').'/', '', (string) $dirofmodule);
@@ -381,8 +379,10 @@ if ($mode == 'desc') {
} elseif (!empty($objMod->enabled_bydefault)) {
$text .= ' ('.$langs->trans("EnabledByDefaultAtInstall").')';
}
- $text .= '
';
}
+
+ $text .= '
'.$langs->trans("Version").': '.$version;
+
$text .= '
';
$moduledesclong = $objMod->getDescLong();
diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index 80ba435d9a9..9c93d797286 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -1113,7 +1113,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
if ($action == 'checklastversion') {
if ($foundoneexternalmodulewithupdate) {
- setEventMessages($langs->trans("ModuleUpdateAvailable"), null, 'warnings');
+ setEventMessages($langs->trans("ModuleUpdateAvailable"), null, 'warnings', '', 0, 1);
} else {
setEventMessages($langs->trans("NoExternalModuleWithUpdate"), null, 'mesgs');
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 491c31b6e31..0ac5ea25bb0 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -9832,10 +9832,11 @@ function dolGetFirstLastname($firstname, $lastname, $nameorder = -1)
* @param string|string[] $mesgs Message string or array
* @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors')
* @param int $noduplicate 1 means we do not add the message if already present in session stack
+ * @param int $attop Add the message in the top of the stack (at bottom by default)
* @return void
* @see dol_htmloutput_events()
*/
-function setEventMessage($mesgs, $style = 'mesgs', $noduplicate = 0)
+function setEventMessage($mesgs, $style = 'mesgs', $noduplicate = 0, $attop = 0)
{
//dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); This is not deprecated, it is used by setEventMessages function
if (!is_array($mesgs)) {
@@ -9845,7 +9846,11 @@ function setEventMessage($mesgs, $style = 'mesgs', $noduplicate = 0)
if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesgs, $_SESSION['dol_events'][$style])) {
return;
}
- $_SESSION['dol_events'][$style][] = $mesgs;
+ if ($attop) {
+ array_unshift($_SESSION['dol_events'][$style], $mesgs);
+ } else {
+ $_SESSION['dol_events'][$style][] = $mesgs;
+ }
}
} else {
// If mesgs is an array
@@ -9855,7 +9860,11 @@ function setEventMessage($mesgs, $style = 'mesgs', $noduplicate = 0)
if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesg, $_SESSION['dol_events'][$style])) {
return;
}
- $_SESSION['dol_events'][$style][] = $mesg;
+ if ($attop) {
+ array_unshift($_SESSION['dol_events'][$style], $mesgs);
+ } else {
+ $_SESSION['dol_events'][$style][] = $mesg;
+ }
}
}
}
@@ -9870,10 +9879,11 @@ function setEventMessage($mesgs, $style = 'mesgs', $noduplicate = 0)
* @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors')
* @param string $messagekey A key to be used to allow the feature "Never show this message during this session again"
* @param int $noduplicate 1 means we do not add the message if already present in session stack
+ * @param int $attop Add the message in the top of the stack (at bottom by default)
* @return void
* @see dol_htmloutput_events()
*/
-function setEventMessages($mesg, $mesgs, $style = 'mesgs', $messagekey = '', $noduplicate = 0)
+function setEventMessages($mesg, $mesgs, $style = 'mesgs', $messagekey = '', $noduplicate = 0, $attop = 0)
{
if (empty($mesg) && empty($mesgs)) {
dol_syslog("Try to add a message in stack, but value to add is empty message", LOG_WARNING);
@@ -9883,17 +9893,17 @@ function setEventMessages($mesg, $mesgs, $style = 'mesgs', $messagekey = '', $no
// TODO
$mesg .= '';
}
- if (empty($messagekey) || empty($_COOKIE["DOLHIDEMESSAGE".$messagekey])) {
+ if (empty($messagekey) || empty($_COOKIE["DOLUSER_HIDEMESSAGE".$messagekey])) {
if (!in_array((string) $style, array('mesgs', 'warnings', 'errors'))) {
dol_print_error(null, 'Bad parameter style='.$style.' for setEventMessages');
}
if (empty($mesgs)) {
- setEventMessage($mesg, $style, $noduplicate);
+ setEventMessage($mesg, $style, $noduplicate, $attop);
} else {
if (!empty($mesg) && !in_array($mesg, $mesgs)) {
- setEventMessage($mesg, $style, $noduplicate); // Add message string if not already into array
+ setEventMessage($mesg, $style, $noduplicate, $attop); // Add message string if not already into array
}
- setEventMessage($mesgs, $style, $noduplicate);
+ setEventMessage($mesgs, $style, $noduplicate, $attop);
}
}
}