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:Créer_un_module_de_numérotation]]
+
[[es:Crear_un_módulo_de_numeración]]
+
[[zh:自动编号模块]]
+
<!-- END interlang links -->
+
{{TemplateDocDevEn}}
{{TemplateDocDevEn}}
For each entity (invoice, proposal, order, etc.) created in the application, Dolibarr assigned a reference number (or text). To adapt the reference to any use, Dolibarr uses numbering modules to define the rule of generation of this reference. The supplied modules are a standard one and a generic on with a configurable mask (numbers on x character, with or without prefix, including the date or not, etc.), which can meet most needs. However, there are still cases where the standard module does not meet the need. In this case it is necessary to develop its own numbering module.
For each entity (invoice, proposal, order, etc.) created in the application, Dolibarr assigned a reference number (or text). To adapt the reference to any use, Dolibarr uses numbering modules to define the rule of generation of this reference. The supplied modules are a standard one and a generic on with a configurable mask (numbers on x character, with or without prefix, including the date or not, etc.), which can meet most needs. However, there are still cases where the standard module does not meet the need. In this case it is necessary to develop its own numbering module.
−
= Create a new module numbering =
+
=Create a new module numbering=
For the example, we assume we will create a new numbering module of invoices, we will call it the 'terrebis' and will be a variant of the standard supplier module 'terre'.
For the example, we assume we will create a new numbering module of invoices, we will call it the 'terrebis' and will be a variant of the standard supplier module 'terre'.
−
* Copy and paste htdocs/core/modules/invoice/earth/terre.modules.php in htdocs/core/modules/invoice/terrebis/terrebis.modules.php. You can use the name you want in place of terrebis while he is not already in use and contains only alphabetic characters.
+
*Copy and paste htdocs/core/modules/invoice/earth/terre.modules.php in htdocs/core/modules/invoice/terrebis/terrebis.modules.php. You can use the name you want in place of terrebis while he is not already in use and contains only alphabetic characters.
−
* edit the new file to make the following changes in the code:
+
*edit the new file to make the following changes in the code:
+
1. Rename the class name to replace the old class name with the chosen name (keep the same naming conventions).
1. Rename the class name to replace the old class name with the chosen name (keep the same naming conventions).
2. Modify the code for the info() method to return a text description of your module.
2. Modify the code for the info() method to return a text description of your module.
−
3.Change the method code of getExemple() to return the an example of value for ra eference that might be returned by the module.
+
3.Change the method code of getExample() to return an example value of a reference that might be returned by the module.
4.Change the method code of canBeActivated() to just do a "return true;"
4.Change the method code of canBeActivated() to just do a "return true;"
Line 28:
Line 37:
6. Save: the template 'terrebis' is available in the list of invoice templates into Dolibarr
6. Save: the template 'terrebis' is available in the list of invoice templates into Dolibarr
−
= Test this module =
+
=Test this module=
Test this module by activating the module from configuration page. Verify that the column description, example and next value you get reflect what you should get (referred respectively by function info(), getExample() and getNextValue()).
Test this module by activating the module from configuration page. Verify that the column description, example and next value you get reflect what you should get (referred respectively by function info(), getExample() and getNextValue()).
+
[[Category:Development]]