FIX install wizard error management

This commit is contained in:
Laurent Destailleur 2022-11-02 00:00:02 +01:00
parent ab2d306abd
commit ff16d74bd2

View File

@ -220,9 +220,9 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) {
print $langs->trans("AdminLoginCreatedSuccessfuly", $login)."<br>"; print $langs->trans("AdminLoginCreatedSuccessfuly", $login)."<br>";
$success = 1; $success = 1;
} else { } else {
if ($newuser->error == 'ErrorLoginAlreadyExists') { if ($result == -6) { //login or email already exists
dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING); dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING);
print '<br><div class="warning">'.$langs->trans("AdminLoginAlreadyExists", $login)."</div><br>"; print '<br><div class="warning">'.$newuser->error."</div><br>";
$success = 1; $success = 1;
} else { } else {
dolibarr_install_syslog('step5: FailedToCreateAdminLogin '.$newuser->error, LOG_ERR); dolibarr_install_syslog('step5: FailedToCreateAdminLogin '.$newuser->error, LOG_ERR);
@ -357,7 +357,8 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) {
// Create lock file // Create lock file
// If first install // If first install
if ($action == "set" && $success) { if ($action == "set") {
if ($success) {
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) { if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
// Install is finished // Install is finished
print $langs->trans("SystemIsInstalled")."<br>"; print $langs->trans("SystemIsInstalled")."<br>";
@ -400,6 +401,7 @@ if ($action == "set" && $success) {
print '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToUpgradePage"); print '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToUpgradePage");
print '</a></div>'; print '</a></div>';
} }
}
} elseif (empty($action) || preg_match('/upgrade/i', $action)) { } elseif (empty($action) || preg_match('/upgrade/i', $action)) {
// If upgrade // If upgrade
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) { if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
@ -443,7 +445,7 @@ if ($action == "set" && $success) {
$morehtml .= '</a></div>'; $morehtml .= '</a></div>';
} }
} else { } else {
dol_print_error('', 'step5.php: unknown choice of action'); dol_print_error('', 'step5.php: unknown choice of action='.$action.' in create lock file seaction');
} }
// Clear cache files // Clear cache files