Generated documents: Difference between revisions

Roughly translated French to English using online translation tool and English fluency.
(Roughly translated French to English using online translation tool and English fluency.)
Line 1: Line 1:
{{TemplateDocDevEn}}
{{TemplateDocDevEn}}
{{ToTranslate}}
{{ToTranslate}}
Les documents générés sont stockés dans le répertoire définit par la constantes DOL_DATA_ROOT
The generated documents are stored in the directory defined by the constant DOL_DATA_ROOT


= Générer des documents dans de nouveaux modules =
= To generate documents in new modules =
Si vous générez des documents dans un nouveau module, vos fichiers doivent être dans
If you generate documents in a new module, your files must be stored in
* DOL_DATA_ROOT/monmodule pour des fichiers permanents.
* DOL_DATA_ROOT/monmodule for permanent files.  
* DOL_DATA_ROOT/monmodule/temp pour des fichiers temporaires.
* DOL_DATA_ROOT/monmodule/temp for temporary files.  
Pour créer ces répertoires, vous pouvez utiliser la fonction
To create these directories, you can use the function to create_exdir (DOL_DATA_ROOT/monmodule);
create_exdir(DOL_DATA_ROOT/monmodule);


Pour générer ces fichiers sur le modèle de Dolibarr, voici les fichiers à créer:
To generate these files on the Dolibarr model, create the following files:
# la fiche où placer la "cartouche" (affichage) permettant à l'utilisateur de générer un nouveau document et de consulter les documents existants
# the card where to place the "cartouche" (posting) allowing the user to generate a new document and to consult the existing documents.
# ''htdocs/includes/modules/mod[type de document].class.php'' au cas où ce fichier n'existerait pas déjà
# ''htdocs/includes/modules/mod [standard of document] .class.php'' if this file wouldn't exist already
# ''htdocs/includes/modules/[type de document]/module_[type].php'' qui contiendra la définition de la classe de génération
# ''htdocs/includes/modules/[standard of document] /module_ [standard] .php'' which will contain the definition of the class of generation
# ''htdocs/includes/modules/[type de document]/pdf_[modele]_[type].modules.php'' qui contiendra le modèle de génération du document
# ''htdocs/includes/modules/[standard of document] /pdf_ [model] _ [standard] .modules.php'' which will contain the model of generation of the document
# ''htdocs/document.php'' qui contient la procédure de livraison des fichiers une fois créés (et leur suppression) - il faut également y ajouter le type de document et le répertoire correspondant
# ''htdocs/document.php'' which contains the procedure of delivery of the files once created (and their suppression) - it is also necessary to add to it the type of document and the corresponding directory
# la(les) classe(s) qui contien(nen)t  les données à afficher  (classes product.class.php ou facture.class.php, ou autres, selon le document à générer)
# The class(es) which contain the data to be posted (classes product.class.php or facture.class.php, or others, according to the document to be generated)


Pour pouvoir downloader les fichiers générés en utilisant le mécanisme de sécurité de Dolibarr, il convient de modifier les fichiers suivant:
To be able to download the files generated by using the mechanism of safety of Dolibarr, it is advisable to modify the files according to:  
# ''htdocs/html.form.class.php'' pour y ajouter, dans la méthode '''show_documents()''', le type de document ajouté
# ''htdocs/html.form.class.php'' to add to it, in the method '''show_documents()''', the type of added document.


Il faut également que le modèle soit inséré dans la base de données, dans la [[Table llx_document_model]] avec pour type le type de document et pour nom le nom de la classe correspondante dans includes/modules (commençant par pdf_).
The model also needs to be inserted into the database, in the [[Table llx_document_model]] the type of document in the type field and the name of the corresponding class in includes/modules (starting with pdf_) in the name field.  


To know how to build an template, see page [[Create an ODT document template]] or [[Create a PDF document template]]. Building a PDF template require PHP development knowledge, but not building an ODT template.
To know how to build a template, see page [[Create an ODT document template]] or [[Create a pdf document template]]. Building a pdf template requires PHP development knowledge, but building an ODT template does not.
3

edits