Line 9:
Line 9:
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/includes/modules/invoice/earth/terre.modules.php in htdocs/includes/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/includes/modules/invoice/earth/terre.modules.php in htdocs/includes/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:
−
# Rename the class name to replace the old class name with the chosen name (keep the same naming conventions).
# Rename the class name to replace the old class name with the chosen name (keep the same naming conventions).
−
# Modify the code for the info() method to return a text description of your module.
# Modify the code for the info() method to return a text description of your module.
−
# Change the method code of getExemple() to return the an example of value for ra eference that might be returned by the module.
# Change the method code of getExemple() to return the an example of value for ra eference that might be returned by the module.
−
# Change the method code of canBeActivated() to just do a "return true;"
# Change the method code of canBeActivated() to just do a "return true;"
−
+
# Modify the code of the method getNextValue() to return the next available reference numbering.
−
5. Modify the code of the method getNextValue() to return the next available reference numbering.
+
Within the code for this function, you can use parameters $objsoc or $facture containing the information of third parties involved in the generation and the object invoice involved in the generation (The name of these variables may differ depending on the nature of the managed entity module). You can also use the objects $langs, $conf and $db (db connection object in the database that allows SQL querying to database).
−
+
# Save: the template 'terrebis' is available in the list of invoice templates into Dolibarr
−
Au sein du code de cette fonction, vous pouvez utilisez les paramètres $objsoc ou $facture qui contiennent les informations du tiers concerné par la génération et l'object concerné par la génération (Le nom de ces variables peut différer selon la nature des l'entité gérée par le module). Vous pouvez de plus utiliser les objets $langs, $conf et $db, à condition de les déclarer par la ligne global $langs, $conf, $db; Ces objets contiennent: $langs: les infos de la langue utilisateur $conf: la configuration Dolibarr $db: l'objet de connexion à la base qui permet d'effectuer des requêtes SQL en base. Within the code for this function, you can use parameters $ $ objsoc or invoice containing the information of third parties involved in the generation and the object involved in the generation (The name of these variables may differ depending on the nature of the managed entity module.) You can also use the objects $ langs, $ conf and $ db, the report provided by the line global $ langs, $ conf $ db; These items include: $ langs: information the user language $ conf: configuration Dolibarr $ db connection object in the database allows querying SQL database.
−
−
6. Save: the template 'terrebis' is available in the list of invoice templates into Dolibarr
= Test this module =
= Test this module =