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

View File

@ -110,7 +110,7 @@ DropTableIfEmpty=(Destroy table if empty)
TableDoesNotExists=The table %s does not exists TableDoesNotExists=The table %s does not exists
TableDropped=Table %s deleted TableDropped=Table %s deleted
InitStructureFromExistingTable=Build the structure array string of an existing table 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 UseDocFolder=Disable the documentation folder
UseSpecificReadme=Use a specific ReadMe 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. ContentOfREADMECustomized=Note: The content of the README.md file has been replaced with the specific value defined into setup of ModuleBuilder.
@ -146,3 +146,4 @@ ModuleBuilderNotAllowed=The module builder is available but not allowed to your
ImportExportProfiles=Import and export profiles ImportExportProfiles=Import and export profiles
ValidateModBuilderDesc=Put 1 if this field need to be validated with $this->validateField() or 0 if validation required 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 '<tr class="oddeven">';
print '<td>'.$langs->trans("UseAboutPage").'</td>'; print '<td>'.$langs->trans("UseAboutPage").'</td>';
print '<td class="center">'; print '<td>';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MODULEBUILDER_USE_ABOUT'); print ajax_constantonoff('MODULEBUILDER_USE_ABOUT');
} else { } else {

View File

@ -3103,14 +3103,14 @@ if ($module == 'initmodule') {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); 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("Title", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("mainmenu", $_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("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("LanguageFile", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Position", $_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); 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("Permission", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Target", $_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 '); 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 dol_escape_htmltag($menu['langs']);
print '</td>'; print '</td>';
print '<td>'; print '<td class="right">';
print dol_escape_htmltag($menu['position']); print dol_escape_htmltag($menu['position']);
print '</td>'; 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 dol_escape_htmltag($menu['enabled']);
print '</td>'; 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 dol_escape_htmltag($menu['perms']);
print '</td>'; print '</td>';
@ -3858,8 +3858,10 @@ if ($module == 'initmodule') {
$FILENAMEDOCPDF = $modulelowercase.'.pdf'; $FILENAMEDOCPDF = $modulelowercase.'.pdf';
$outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC; $outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC;
$outputfiledocurl = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOC; $outputfiledocurl = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOC;
$outputfiledocrel = $modulelowercase.'/doc/'.$FILENAMEDOC;
$outputfiledocpdf = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOCPDF; $outputfiledocpdf = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOCPDF;
$outputfiledocurlpdf = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOCPDF; $outputfiledocurlpdf = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOCPDF;
$outputfiledocrelpdf = $modulelowercase.'/doc/'.$FILENAMEDOCPDF;
// HTML // HTML
print '<span class="fa fa-file-o"></span> '.$langs->trans("PathToModuleDocumentation", "HTML").' : '; print '<span class="fa fa-file-o"></span> '.$langs->trans("PathToModuleDocumentation", "HTML").' : ';
@ -3872,6 +3874,7 @@ if ($module == 'initmodule') {
print '</a>'; print '</a>';
print '</strong>'; print '</strong>';
print ' <span class="opacitymedium">('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')</span>'; 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>'; print '</strong><br>';
@ -3886,6 +3889,7 @@ if ($module == 'initmodule') {
print '</a>'; print '</a>';
print '</strong>'; print '</strong>';
print ' <span class="opacitymedium">('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledocpdf), 'dayhour').')</span>'; 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>'; print '</strong><br>';
@ -3952,8 +3956,11 @@ if ($module == 'initmodule') {
$relativepath = $modulelowercase.'/bin/'.$FILENAMEZIP; $relativepath = $modulelowercase.'/bin/'.$FILENAMEZIP;
print '<strong><a href="'.DOL_URL_ROOT.'/document.php?modulepart=packages&file='.urlencode($relativepath).'">'.$outputfilezip.'</a></strong>'; 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 ' <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>'; print '<br>';