From c4ffa090b26f77c12155cfc9b12e6363bb0a3a70 Mon Sep 17 00:00:00 2001 From: lamrani abdelwadoud Date: Thu, 26 Sep 2024 17:43:23 +0200 Subject: [PATCH] New redirect when deploy module (#31109) * New redirect when deploy module * initialize variable --------- Co-authored-by: Laurent Destailleur --- htdocs/admin/modules.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 38c7b5d23e6..80ba435d9a9 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -165,7 +165,7 @@ if (GETPOST('buttonreset', 'alpha')) { if ($action == 'install' && $allowonlineinstall) { $error = 0; - + $modulenameval = ''; // $original_file should match format module_modulename-x.y[.z].zip $original_file = basename($_FILES["fileinstall"]["name"]); $original_file = preg_replace('/\s*\(\d+\)\.zip$/i', '.zip', $original_file); @@ -282,8 +282,20 @@ if ($action == 'install' && $allowonlineinstall) { } if (!$error) { - $message = $langs->trans("SetupIsReadyForUse", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")); + $searchParams = array( + 'search_keyword' => $modulenameval, + 'search_status' => '-1', + 'search_nature' => '-1', + 'search_version' => '-1' + ); + $queryString = http_build_query($searchParams); + $redirectUrl = DOL_URL_ROOT . '/admin/modules.php?' . $queryString; + + $message = $langs->trans("SetupIsReadyForUse", $redirectUrl, $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")); + setEventMessages($message, null, 'warnings'); + header('Location: ' . $redirectUrl); + exit; } } elseif ($action == 'install' && !$allowonlineinstall) { httponly_accessforbidden("You try to bypass the protection to disallow deployment of an external module. Hack attempt ?");