Generated documents: Difference between revisions

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
(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.

Revision as of 00:32, 3 November 2011

En verysmall.png Page waiting for translation. To translate, create an account, go back and clic on "Modify".
Fr verysmall.png Page en attente de traduction. Pour traduire, créez un compte, revenez et cliquez sur "Modifier".
Es verysmall.png Página a traducir. Para traducirla, cree una cuenta, vuelva a la página y haga clic en "editar".
It verysmall.png Pagina da tradurre. Per tradurla, crea un utente, torna indietro e clicca su "modifica".
Pt verysmall.png Página a aguardar por tradução. Para traduzir, crie uma conta, volte atrás e clique em "Modificar".
De verysmall.png Seite wartet auf Übersetzung. Um Übersetzung zu erstellen, richte einen Account ein, geh zurück und klicke auf "bearbeiten".
Zh verysmall.png 页面等待翻译。若要翻译本页,先创建一个帐户、登录并返回本页后单击“编辑”。

The generated documents are stored in the directory defined by the constant DOL_DATA_ROOT

To generate documents in new modules

If you generate documents in a new module, your files must be stored in

  • DOL_DATA_ROOT/monmodule for permanent files.
  • DOL_DATA_ROOT/monmodule/temp for temporary files.

To create these directories, you can use the function to create_exdir (DOL_DATA_ROOT/monmodule);

To generate these files on the Dolibarr model, create the following files:

  1. the card where to place the "cartouche" (posting) allowing the user to generate a new document and to consult the existing documents.
  2. htdocs/includes/modules/mod [standard of document] .class.php if this file wouldn't exist already
  3. htdocs/includes/modules/[standard of document] /module_ [standard] .php which will contain the definition of the class of generation
  4. htdocs/includes/modules/[standard of document] /pdf_ [model] _ [standard] .modules.php which will contain the model of generation of the document
  5. 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
  6. 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)

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:

  1. htdocs/html.form.class.php to add to it, in the method show_documents(), the type of added document.

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