Generation of PDF doc

This commit is contained in:
Laurent Destailleur 2019-03-13 18:11:15 +01:00
parent ae6b672204
commit e0208cb3d6
3 changed files with 22 additions and 6 deletions

View File

@ -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')
{

View File

@ -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

View File

@ -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 '<br>';
@ -2842,7 +2845,8 @@ elseif (! empty($module))
print '<br><br><br>';
print '<span class="fa fa-file-o"></span> '. $langs->trans("PathToModuleDocumentation") . ' : ';
// HTML
print '<span class="fa fa-file-o"></span> '. $langs->trans("PathToModuleDocumentation", "HTML") . ' : ';
if (! dol_is_file($outputfiledoc)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>';
else {
print '<strong>';
@ -2854,6 +2858,19 @@ elseif (! empty($module))
}
print '</strong><br>';
// PDF
print '<span class="fa fa-file-o"></span> '. $langs->trans("PathToModuleDocumentation", "PDF") . ' : ';
if (! dol_is_file($outputfiledocpdf)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>';
else {
print '<strong>';
print '<a href="'.$outputfiledocurlpdf.'" target="_blank">';
print $outputfiledocpdf;
print '</a>';
print '</strong>';
print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledocpdf), 'dayhour').')';
}
print '</strong><br>';
print '<br>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="generatedoc">';