Generated documents: Difference between revisions

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
(Created page with '{{TemplateDocDev}} {{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...')
 
(Add Chinese)
Tag: 2017 source edit
 
(14 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{TemplateDocDev}}
<!-- BEGIN origin interlang links -->
{{ToTranslate}}
<!-- You can edit this section but do NOT remove these comments
Les documents générés sont stockés dans le répertoire définit par la constantes DOL_DATA_ROOT
    Links below will be automatically replicated on translated pages by PolyglotBot -->
[[fr:Documents_générés]]
[[es:Documentos_generados]]
[[zh:生成的文件]]
<!-- END interlang links -->


= Générer des documents dans de nouveaux modules =
{{TemplateDocDevEn}}
Si vous générez des documents dans un nouveau module, vos fichiers générés seront dans
The generated documents are stored in the directory defined by the constant DOL_DATA_ROOT
* DOL_DATA_ROOT/monmodule  pour des fichiers permanents.
* DOL_DATA_ROOT/monmodule/temp  pour des fichiers temporaires.
Pour créer ces répertoires, vous pouvez utiliser la fonction
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 documents in new modules =
# la fiche où placer la "cartouche" (affichage) permettant à l'utilisateur de générer un nouveau document et de consulter les documents existants
If you generate documents in a new module, your files must be stored in
# ''htdocs/includes/modules/mod[type de document].class.php'' au cas où ce fichier n'existerait pas déjà
* DOL_DATA_ROOT/mymodule for permanent files.  
# ''htdocs/includes/modules/[type de document]/module_[type].php'' qui contiendra la définition de la classe de génération
* DOL_DATA_ROOT/mymodule/temp for temporary files.  
# ''htdocs/includes/modules/[type de document]/pdf_[modele]_[type].modules.php'' qui contiendra le modèle de génération du document
To create these directories, you can use the function
# ''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
<syntaxHighlight lang="php">
# 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)
dol_mkdir(DOL_DATA_ROOT.'/mymodule');
</syntaxHighlight>


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 generate these files on the Dolibarr model, create the following files:
# ''htdocs/html.form.class.php'' pour y ajouter, dans la méthode '''show_documents()''', le type de document ajouté
# the page where to place the "cartouche" (posting) allowing the user to generate a new document and to consult the existing documents.
# ''htdocs/core/modules/mod [standard of document] .class.php'' if this file wouldn't exist already
# ''htdocs/core/modules/[standard of document] /module_ [standard] .php'' which will contain the definition of the class of generation
# ''htdocs/core/modules/[standard of document] /pdf_ [model] _ [standard] .modules.php'' which will contain the model of generation of the document
# ''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
# 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)


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_).
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:
{{ToComplete}}


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:
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.
[[Creer un modele de document]]
 
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.

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.