diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 765a72d38a7..94d4466fdbe 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -851,19 +851,15 @@ if ($mode == 'common' || $mode == 'commonkanban') { $versiontrans .= $objMod->getVersion(1); } - if ($objMod->isCoreOrExternalModule() == 'external' - && ( - $action == 'checklastversion' - // This is a bad practice to activate a check on an external access during the building of the admin page. 1 external module can hang the application. - // Adding a cron job could be a good idea: see DolibarrModules::checkForUpdate() - || getDolGlobalString('CHECKLASTVERSION_EXTERNALMODULE') - ) - ) { + if ($objMod->isCoreOrExternalModule() == 'external' && ($action == 'checklastversion' || getDolGlobalString('CHECKLASTVERSION_EXTERNALMODULE'))) { + // Setting CHECKLASTVERSION_EXTERNALMODULE to on is a bad practice to activate a check on an external access during the building of the admin page. + // 1 external module can hang the application. + // Adding a cron job could be a good idea: see DolibarrModules::checkForUpdate() $checkRes = $objMod->checkForUpdate(); if ($checkRes > 0) { - setEventMessage($objMod->getName().' : '.$versiontrans.' -> '.$objMod->lastVersion); + setEventMessages($objMod->getName().' : '.$versiontrans.' -> '.$objMod->lastVersion, null, 'warnings'); } elseif ($checkRes < 0) { - setEventMessage($objMod->getName().' '.$langs->trans('CheckVersionFail'), 'warnings'); + setEventMessages($objMod->getName().' '.$langs->trans('CheckVersionFail'), null, 'errors'); } } @@ -1092,7 +1088,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { if ($action == 'checklastversion') { if ($foundoneexternalmodulewithupdate) { - setEventMessages($langs->trans("ModuleUpdateAvailable"), null, 'mesgs'); + setEventMessages($langs->trans("ModuleUpdateAvailable"), null, 'warnings'); } else { setEventMessages($langs->trans("NoExternalModuleWithUpdate"), null, 'mesgs'); } diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index b0ba5d69290..88232c594f0 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2606,9 +2606,10 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } /** - * Check for module update - * TODO : store results for $this->url_last_version and $this->needUpdate - * Add a cron task to monitor for updates + * Check for module update. + * Get URL content of $this->url_last_version and set $this->lastVersion and$this->needUpdate + * TODO Store result in DB. + * TODO Add a cron task to monitor for updates. * * @return int Return integer <0 if Error, 0 == no update needed, >0 if need update */