forked from Wavyzz/dolibarr
NeW Can add the info messages (error, waring...) at the top of the stack
This commit is contained in:
@@ -350,8 +350,6 @@ if ($mode == 'desc') {
|
|||||||
|
|
||||||
$text .= '<br><span class="opacitymedium">'.$langs->trans("IdModule").':</span> '.$objMod->numero;
|
$text .= '<br><span class="opacitymedium">'.$langs->trans("IdModule").':</span> '.$objMod->numero;
|
||||||
|
|
||||||
$text .= '<br><span class="opacitymedium">'.$langs->trans("Version").':</span> '.$version;
|
|
||||||
|
|
||||||
$textexternal = '';
|
$textexternal = '';
|
||||||
if ($objMod->isCoreOrExternalModule() == 'external') {
|
if ($objMod->isCoreOrExternalModule() == 'external') {
|
||||||
$tmpdirofmoduletoshow = preg_replace('/^'.preg_quote(DOL_DOCUMENT_ROOT, '/').'/', '', (string) $dirofmodule);
|
$tmpdirofmoduletoshow = preg_replace('/^'.preg_quote(DOL_DOCUMENT_ROOT, '/').'/', '', (string) $dirofmodule);
|
||||||
@@ -381,8 +379,10 @@ if ($mode == 'desc') {
|
|||||||
} elseif (!empty($objMod->enabled_bydefault)) {
|
} elseif (!empty($objMod->enabled_bydefault)) {
|
||||||
$text .= ' <span class="italic opacitymedium">('.$langs->trans("EnabledByDefaultAtInstall").')</span>';
|
$text .= ' <span class="italic opacitymedium">('.$langs->trans("EnabledByDefaultAtInstall").')</span>';
|
||||||
}
|
}
|
||||||
$text .= '<br>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$text .= '<br><span class="opacitymedium">'.$langs->trans("Version").':</span> '.$version;
|
||||||
|
|
||||||
$text .= '<br>';
|
$text .= '<br>';
|
||||||
|
|
||||||
$moduledesclong = $objMod->getDescLong();
|
$moduledesclong = $objMod->getDescLong();
|
||||||
|
|||||||
@@ -1113,7 +1113,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
|||||||
|
|
||||||
if ($action == 'checklastversion') {
|
if ($action == 'checklastversion') {
|
||||||
if ($foundoneexternalmodulewithupdate) {
|
if ($foundoneexternalmodulewithupdate) {
|
||||||
setEventMessages($langs->trans("ModuleUpdateAvailable"), null, 'warnings');
|
setEventMessages($langs->trans("ModuleUpdateAvailable"), null, 'warnings', '', 0, 1);
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("NoExternalModuleWithUpdate"), null, 'mesgs');
|
setEventMessages($langs->trans("NoExternalModuleWithUpdate"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9832,10 +9832,11 @@ function dolGetFirstLastname($firstname, $lastname, $nameorder = -1)
|
|||||||
* @param string|string[] $mesgs Message string or array
|
* @param string|string[] $mesgs Message string or array
|
||||||
* @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors')
|
* @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 $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
|
* @return void
|
||||||
* @see dol_htmloutput_events()
|
* @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
|
//dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); This is not deprecated, it is used by setEventMessages function
|
||||||
if (!is_array($mesgs)) {
|
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])) {
|
if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesgs, $_SESSION['dol_events'][$style])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$_SESSION['dol_events'][$style][] = $mesgs;
|
if ($attop) {
|
||||||
|
array_unshift($_SESSION['dol_events'][$style], $mesgs);
|
||||||
|
} else {
|
||||||
|
$_SESSION['dol_events'][$style][] = $mesgs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If mesgs is an array
|
// 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])) {
|
if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesg, $_SESSION['dol_events'][$style])) {
|
||||||
return;
|
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 $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 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 $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
|
* @return void
|
||||||
* @see dol_htmloutput_events()
|
* @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)) {
|
if (empty($mesg) && empty($mesgs)) {
|
||||||
dol_syslog("Try to add a message in stack, but value to add is empty message", LOG_WARNING);
|
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
|
// TODO
|
||||||
$mesg .= '';
|
$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'))) {
|
if (!in_array((string) $style, array('mesgs', 'warnings', 'errors'))) {
|
||||||
dol_print_error(null, 'Bad parameter style='.$style.' for setEventMessages');
|
dol_print_error(null, 'Bad parameter style='.$style.' for setEventMessages');
|
||||||
}
|
}
|
||||||
if (empty($mesgs)) {
|
if (empty($mesgs)) {
|
||||||
setEventMessage($mesg, $style, $noduplicate);
|
setEventMessage($mesg, $style, $noduplicate, $attop);
|
||||||
} else {
|
} else {
|
||||||
if (!empty($mesg) && !in_array($mesg, $mesgs)) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user