Generated documents

From Dolibarr Open Source ERP CRM Wiki

Return to developer
documentation index

File Doc dev.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/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"
Cn 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.

Personal tools
  • Ask to contact@dolibarr.org to request an account to contribute to this documentation
  • Log in
In other languages
FrenchSpanishDeutsch
No translation in Deutsch.
Italian
No translation in Italian.
Greek
No translation in Greek.
<multilanguagemanager_cn>
No translation in &lt;multilanguagemanager_cn&gt;.

Social networks
Follow us on Google+ Follow us on Facebook Follow us on LinkedIn Follow us on Twitter