FIX Delete of doc and package in modulebuilder

This commit is contained in:
Laurent Destailleur 2022-03-11 16:21:28 +01:00
parent 11d18fae4a
commit f72f71a972
4 changed files with 29 additions and 13 deletions

View File

@ -847,8 +847,13 @@ class Utils
$resarray = $utils->executeCLI($command, $outfile);
if ($resarray['result'] != '0') {
$this->error = $resarray['error'].' '.$resarray['output'];
$this->errors[] = $this->error;
}
$result = ($resarray['result'] == 0) ? 1 : 0;
if ($result < 0 && empty($this->errors)) {
$this->error = $langs->trans("ErrorFailToGenerateFile", $FILENAMEDOC);
$this->errors[] = $this->error;
}
// Build PDF doc
$command = $conf->global->MODULEBUILDER_ASCIIDOCTORPDF.' '.$destfile.' -n -o '.$dirofmoduledoc.'/'.$FILENAMEDOCPDF;
@ -856,8 +861,13 @@ class Utils
$resarray = $utils->executeCLI($command, $outfile);
if ($resarray['result'] != '0') {
$this->error = $resarray['error'].' '.$resarray['output'];
$this->errors[] = $this->error;
}
$result = ($resarray['result'] == 0) ? 1 : 0;
if ($result < 0 && empty($this->errors)) {
$this->error = $langs->trans("ErrorFailToGenerateFile", $FILENAMEDOCPDF);
$this->errors[] = $this->error;
}
chdir($currentdir);
} else {
@ -868,8 +878,6 @@ class Utils
return 1;
} else {
$error++;
$langs->load("errors");
$this->error = $langs->trans("ErrorFailToGenerateFile", $outputfiledoc);
}
} else {
$error++;

View File

@ -110,7 +110,7 @@ DropTableIfEmpty=(Destroy table if empty)
TableDoesNotExists=The table %s does not exists
TableDropped=Table %s deleted
InitStructureFromExistingTable=Build the structure array string of an existing table
UseAboutPage=Disable the about page
UseAboutPage=Do not generate the About page
UseDocFolder=Disable the documentation folder
UseSpecificReadme=Use a specific ReadMe
ContentOfREADMECustomized=Note: The content of the README.md file has been replaced with the specific value defined into setup of ModuleBuilder.
@ -145,4 +145,5 @@ TableNotEmptyDropCanceled=Table not empty. Drop has been canceled.
ModuleBuilderNotAllowed=The module builder is available but not allowed to your user.
ImportExportProfiles=Import and export profiles
ValidateModBuilderDesc=Put 1 if this field need to be validated with $this->validateField() or 0 if validation required
WarningDatabaseIsNotUpdated=Warning: The database is not updated automatically, you must destroy tables and disable-enable the module to have tables recreated
WarningDatabaseIsNotUpdated=Warning: The database is not updated automatically, you must destroy tables and disable-enable the module to have tables recreated
LinkToParentMenu=Parent menu (fk_xxxxmenu)

View File

@ -120,7 +120,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
print '<tr class="oddeven">';
print '<td>'.$langs->trans("UseAboutPage").'</td>';
print '<td class="center">';
print '<td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MODULEBUILDER_USE_ABOUT');
} else {

View File

@ -3103,14 +3103,14 @@ if ($module == 'initmodule') {
print '<tr class="liste_titre">';
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("fk_menu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("LinkToParentMenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Title", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("mainmenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("leftmenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("URL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("RelativeURL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("LanguageFile", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Enabled", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Enabled", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Permission", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Target", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("UserType", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'right ');
@ -3148,15 +3148,15 @@ if ($module == 'initmodule') {
print dol_escape_htmltag($menu['langs']);
print '</td>';
print '<td>';
print '<td class="right">';
print dol_escape_htmltag($menu['position']);
print '</td>';
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($menu['enabled']).'">';
print '<td class="center tdoverflowmax200" title="'.dol_escape_htmltag($menu['enabled']).'">';
print dol_escape_htmltag($menu['enabled']);
print '</td>';
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($menu['perms']).'">';
print '<td class="center tdoverflowmax200" title="'.dol_escape_htmltag($menu['perms']).'">';
print dol_escape_htmltag($menu['perms']);
print '</td>';
@ -3858,8 +3858,10 @@ if ($module == 'initmodule') {
$FILENAMEDOCPDF = $modulelowercase.'.pdf';
$outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC;
$outputfiledocurl = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOC;
$outputfiledocrel = $modulelowercase.'/doc/'.$FILENAMEDOC;
$outputfiledocpdf = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOCPDF;
$outputfiledocurlpdf = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOCPDF;
$outputfiledocrelpdf = $modulelowercase.'/doc/'.$FILENAMEDOCPDF;
// HTML
print '<span class="fa fa-file-o"></span> '.$langs->trans("PathToModuleDocumentation", "HTML").' : ';
@ -3872,6 +3874,7 @@ if ($module == 'initmodule') {
print '</a>';
print '</strong>';
print ' <span class="opacitymedium">('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')</span>';
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&token='.newToken().'&format='.$format.'&file='.urlencode($outputfiledocrel).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
}
print '</strong><br>';
@ -3886,6 +3889,7 @@ if ($module == 'initmodule') {
print '</a>';
print '</strong>';
print ' <span class="opacitymedium">('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledocpdf), 'dayhour').')</span>';
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&token='.newToken().'&format='.$format.'&file='.urlencode($outputfiledocpdfrel).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
}
print '</strong><br>';
@ -3952,8 +3956,11 @@ if ($module == 'initmodule') {
$relativepath = $modulelowercase.'/bin/'.$FILENAMEZIP;
print '<strong><a href="'.DOL_URL_ROOT.'/document.php?modulepart=packages&file='.urlencode($relativepath).'">'.$outputfilezip.'</a></strong>';
print ' <span class="opacitymedium">('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfilezip), 'dayhour').')</span>';
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&token='.newToken().'&format='.$format.'&file='.urlencode($relativepath).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
}
print '</strong><br>';
print '</strong>';
print '<br>';
print '<br>';