Dolibarr ERP CRM is a modern software package to manage your company or foundation's activity (contacts, suppliers, invoices, orders, stocks, agenda, accounting, ...). it's an open source Web application (written in PHP) designed for businesses of any sizes, foundations and freelancers.
On Dolibarr v19.0.3 installation, in a third-party module file, I have the following code:
require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
$soc = new Societe($db);
$propale = new Propal($db);
$commande = new Commande($db);
$facture = new Facture($db);
...
$refPropal = $propale->getNextNumRef($soc);
$refCommande = $commande->getNextNumRef($soc);
$refFacture = $facture->getNextNumRef($soc);
The ref numbers for the proposal and the invoice are generated correctly. However, for the order (commande) I get SO-0001 i.e. the month and the date are not added. For example, the correct value should be SO-2411-0001
The same happens when generating vendor purchase orders.
On Dolibarr v20.0.1, the same problem occurs for the commercial invoice and vendor invoices.
On Dolibarr v17.0.4 and v18.0.6 I have no issues
Is something generally changed in the code or can I think of an incomplete/fault installation?
Dolibarr Version
19.0, 20.0
Environment PHP
8.1.10
Environment Database
My SQL 8.2.0
Steps to reproduce the behavior and expected behavior
Did you set the date of the object ($object->date = dol_now();) before calling the getNextNumRef() method ? . If no, can you please provide more of your code ?
Bug
On Dolibarr v19.0.3 installation, in a third-party module file, I have the following code:
The ref numbers for the proposal and the invoice are generated correctly. However, for the order (commande) I get
SO-0001
i.e. the month and the date are not added. For example, the correct value should beSO-2411-0001
The same happens when generating vendor purchase orders.
On Dolibarr v20.0.1, the same problem occurs for the commercial invoice and vendor invoices.
On Dolibarr v17.0.4 and v18.0.6 I have no issues
Is something generally changed in the code or can I think of an incomplete/fault installation?
Dolibarr Version
19.0, 20.0
Environment PHP
8.1.10
Environment Database
My SQL 8.2.0
Steps to reproduce the behavior and expected behavior
No response
Attached files
log.txt