Generated documents: Difference between revisions

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
(Add Chinese)
Tag: 2017 source edit
 
(10 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<!-- BEGIN origin interlang links -->
<!-- You can edit this section but do NOT remove these comments
    Links below will be automatically replicated on translated pages by PolyglotBot -->
[[fr:Documents_générés]]
[[es:Documentos_generados]]
[[zh:生成的文件]]
<!-- END interlang links -->
{{TemplateDocDevEn}}
{{TemplateDocDevEn}}
To know how to build a PDF template, see page [[Create a PDF document template]].
The generated documents are stored in the directory defined by the constant DOL_DATA_ROOT
 
{{ToTranslate}}
Les documents générés sont stockés dans le répertoire définit par la constantes 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 générés seront 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/mymodule for permanent files.  
* DOL_DATA_ROOT/monmodule/temp pour des fichiers temporaires.
* DOL_DATA_ROOT/mymodule/temp for temporary files.  
Pour créer ces répertoires, vous pouvez utiliser la fonction
To create these directories, you can use the function
create_exdir(DOL_DATA_ROOT/monmodule);
<syntaxHighlight lang="php">
dol_mkdir(DOL_DATA_ROOT.'/mymodule');
</syntaxHighlight>


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 page 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/core/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/core/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/core/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é
{{ToComplete}}


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.  


Plus de documentation au sujet de la génération des modèles elle-même est disponible sur la page d'aperçu des modèles:
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.
[[Creer un modele de document]]

Latest revision as of 07:34, 9 October 2023


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/mymodule for permanent files.
  • DOL_DATA_ROOT/mymodule/temp for temporary files.

To create these directories, you can use the function

dol_mkdir(DOL_DATA_ROOT.'/mymodule');

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

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

En verysmall.png Page waiting to complete. To complete, create an account, go back and clic on "Modify".
Fr verysmall.png Page en attente d'être complété. Pour compléter, créez un compte, revenez et cliquez sur "Modifier".
Es verysmall.png Página a completar. Para completarla, cree una cuenta, vuelva a la página y haga clic en "editar"
De verysmall.png Seite wartet auf Vervollständigung. Um zu helfen, erstelle ein Konto, gehe zurück und klicke auf "Bearbeiten".
Cn verysmall.png 待完成,欲帮助完成,注册帐号,点击“编辑"
Jp verysmall.png ページは未完成の状態です。完成させるにはアカウントを作成し、ページに戻って「編集」をクリックして下さい。

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.