Can add a hidden message MAIN_FORCE_UPGRADE_MESSAGE on home page

This commit is contained in:
Laurent Destailleur 2026-05-04 10:47:14 +02:00
parent b0dca0eb46
commit ca806bda83
2 changed files with 17 additions and 2 deletions

View file

@ -96,11 +96,11 @@ $resultboxes = FormOther::getBoxesArea($user, "0"); // Load $resultboxes (select
if (getDolGlobalString('MAIN_MOTD')) {
$conf->global->MAIN_MOTD = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', getDolGlobalString('MAIN_MOTD'));
$motd = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', getDolGlobalString('MAIN_MOTD'));
$substitutionarray = getCommonSubstitutionArray($langs);
complete_substitutions_array($substitutionarray, $langs);
$texttoshow = make_substitutions(getDolGlobalString('MAIN_MOTD'), $substitutionarray, $langs);
$texttoshow = make_substitutions($motd, $substitutionarray, $langs);
print "\n<!-- Start of welcome text -->\n";
print '<table class="centpercent notopnoleftnoright"><tr><td>';
@ -122,6 +122,20 @@ if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
}
*/
if (getDolGlobalString('MAIN_FORCE_UPGRADE_MESSAGE') || getDolGlobalString('MAIN_FORCE_UPGRADE_URL')) {
$langs->loadLangs(array("other"));
if (is_numeric(getDolGlobalString('MAIN_FORCE_UPGRADE_MESSAGE'))) {
$messagetoshow = $langs->trans("YourInstallIsOldThanksToUpgrade");
} else {
$messagetoshow = $langs->trans(getDolGlobalString('MAIN_FORCE_UPGRADE_MESSAGE', "YourInstallIsOldThanksToUpgrade"));
}
if (getDolGlobalString('MAIN_FORCE_UPGRADE_URL')) {
$messagetoshow .= '<br><a href="'.getDolGlobalString('MAIN_FORCE_UPGRADE_URL').'" target="_blank">'.getDolGlobalString('MAIN_FORCE_UPGRADE_URL').'</a>';
}
print info_admin($messagetoshow, 0, 0, 'warning', 'clearboth');
}
/*
* Show security warnings
*/

View file

@ -431,3 +431,4 @@ ToggleMicrophone=Toggle Microphone
TypeYourQuestion=Type your question...
SendPrompt=Send
ConfirmAiAction=Are you sure you want to %1$s using the %2$s tool?
YourInstallIsOldThanksToUpgrade=Your Dolibarr version seems to be an old version. Thanks to request an upgrade from your customer dashboard.