From e0208cb3d66ae1c921e91feb222f5015a324d591 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Mar 2019 18:11:15 +0100 Subject: [PATCH] Generation of PDF doc --- htdocs/core/class/utils.class.php | 3 +-- htdocs/langs/en_US/modulebuilder.lang | 2 +- htdocs/modulebuilder/index.php | 23 ++++++++++++++++++++--- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 4e6a989e12f..d3f8e55832a 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -705,9 +705,8 @@ class Utils $result = ($resarray['result'] == 0) ? 1 : 0; // Build PDF doc - $command=$conf->global->MODULEBUILDER_ASCIIDOCTORPDF.' '.$destfile.' -n -o '.$dirofmoduledoc.'/'.$FILENAMEDOC; + $command=$conf->global->MODULEBUILDER_ASCIIDOCTORPDF.' '.$destfile.' -n -o '.$dirofmoduledoc.'/'.$FILENAMEDOCPDF; $outfile=$dirofmoduletmp.'/outpdf.tmp'; - $resarray = $utils->executeCLI($command, $outfile); if ($resarray['result'] != '0') { diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 371bc0c6ee5..329c4921ca3 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -40,7 +40,7 @@ PageForAgendaTab=PHP page for event tab PageForDocumentTab=PHP page for document tab PageForNoteTab=PHP page for note tab PathToModulePackage=Path to zip of module/application package -PathToModuleDocumentation=Path to file of module/application documentation +PathToModuleDocumentation=Path to file of module/application documentation (%s) SpaceOrSpecialCharAreNotAllowed=Spaces or special characters are not allowed. FileNotYetGenerated=File not yet generated RegenerateClassAndSql=Erase and regenerate class and sql files diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index af51071d674..b5559534a3b 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -930,7 +930,7 @@ if ($dirins && $action == 'generatepackage') if ($dirins && $action == 'generatedoc') { - $FILENAMEDOC=strtolower($module).'.html'; // TODO Use/text PDF + $FILENAMEDOC=strtolower($module).'.html'; $dirofmodule = dol_buildpath(strtolower($module), 0).'/doc'; $outputfiledoc = $dirofmodule.'/'.$FILENAMEDOC; @@ -947,6 +947,7 @@ if ($dirins && $action == 'generatedoc') } } + // Save file if ($action == 'savefile' && empty($cancel)) { @@ -2814,9 +2815,11 @@ elseif (! empty($module)) $outputfilezip = dol_buildpath($modulelowercase, 0).'/bin/'.$FILENAMEZIP; $FILENAMEDOC=$modulelowercase.'.html'; + $FILENAMEDOCPDF=$modulelowercase.'.pdf'; $outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC; $outputfiledocurl = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOC; - // TODO Use/test PDF + $outputfiledocpdf = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOCPDF; + $outputfiledocurlpdf = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOCPDF; } print '
'; @@ -2842,7 +2845,8 @@ elseif (! empty($module)) print '


'; - print ' '. $langs->trans("PathToModuleDocumentation") . ' : '; + // HTML + print ' '. $langs->trans("PathToModuleDocumentation", "HTML") . ' : '; if (! dol_is_file($outputfiledoc)) print ''.$langs->trans("FileNotYetGenerated").''; else { print ''; @@ -2854,6 +2858,19 @@ elseif (! empty($module)) } print '
'; + // PDF + print ' '. $langs->trans("PathToModuleDocumentation", "PDF") . ' : '; + if (! dol_is_file($outputfiledocpdf)) print ''.$langs->trans("FileNotYetGenerated").''; + else { + print ''; + print ''; + print $outputfiledocpdf; + print ''; + print ''; + print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledocpdf), 'dayhour').')'; + } + print '
'; + print '
'; print '
';