Add form setup and backport as default setup builder

This commit is contained in:
John BOTELLA
2022-05-21 00:33:28 +02:00
parent fb74bbc204
commit 72bfedaba1
2 changed files with 95 additions and 234 deletions

View File

@@ -238,6 +238,33 @@ if ($dirins && $action == 'initmodule' && $modulename) {
}
}
// Copy last html.formsetup.class.php' to backport folder
$tryToCopyFromSetupClass = true;
$backportDest = $destdir .'/backport/v17/core/class';
$backportFileSrc = DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
$backportFileDest = $backportDest.'/html.formsetup.class.php';
$result = dol_mkdir($backportDest);
if ($result < 0) {
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorFailToCreateDir", $backportDest), null, 'errors');
$tryToCopyFromSetupClass = true;
}
if ($tryToCopyFromSetupClass) {
$result = dol_copy($backportFileSrc, $backportFileDest);
if ($result <= 0) {
if ($result < 0) {
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorFailToCopyFile", $backportFileSrc, $backportFileDest), null, 'errors');
} else {
setEventMessages($langs->trans("AllFilesDidAlreadyExist", $backportFileDest), null, 'warnings');
}
}
}
if (!empty($conf->global->MODULEBUILDER_USE_ABOUT)) {
dol_delete_file($destdir.'/admin/about.php');
}