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.
I have a custom trigger that worked fine in 19.0.3, but for some reason in 20.0.0 it will only update the total_ht field. The other 4 total fields remain unchanged in the database following the object->update($user, 1) command. Any suggestions as to what changed in 20.0.0 that would have made this happen?
Dolibarr Version
20.0.0
Environment PHP
8.2.23
Environment Database
mysql (8.0.39-0ubuntu0.24.04.2)
Steps to reproduce the behavior and expected behavior
The Issue
In my custom module trigger file, I am trying to update the total price for an invoice and proposal line item. In 19.0.3 my code worked which enabled me to calculate an extra quantity field and update the line totals accordingly.
For an unknown reason (I cannot find anything in the change logs referencing this), only the total_ht field updates while, total_tva, total_localtax1, total_localtax2, and total_ttc remain unchanged after running an object->update with the updated amounts in the object.
CODE
The Trigger
case 'LINEBILL_MODIFY': $main_object=new Facture($this->db); $main_object->fetch($object->fk_facture); if ($main_object->array_options['options_isrental']) { $this->adjust_rental($action, $object, $main_object, $user, $langs, $conf); }; break;
The custom function:
`public function adjust_rental($action, $line_object, $main_object, User $user, Translate $langs, Conf $conf) {
For additional context, rental_length is an extra_field that serves as an additional quantity field that we use for rental events. For example, we want to rent 4 boxes for 4 days, the updated_qty should be 16. I need to update the rest of the total fields in
Attached files
The custom fields on the invoice card:
The tooltip shows the correct amount in v. 19.0.3 after updating the fields as expected
The tooltip shows the incorrect amount in v. 20.0.0 after updating the fields
Bug
I have a custom trigger that worked fine in 19.0.3, but for some reason in 20.0.0 it will only update the total_ht field. The other 4 total fields remain unchanged in the database following the object->update($user, 1) command. Any suggestions as to what changed in 20.0.0 that would have made this happen?
Dolibarr Version
20.0.0
Environment PHP
8.2.23
Environment Database
mysql (8.0.39-0ubuntu0.24.04.2)
Steps to reproduce the behavior and expected behavior
The Issue
In my custom module trigger file, I am trying to update the total price for an invoice and proposal line item. In 19.0.3 my code worked which enabled me to calculate an extra quantity field and update the line totals accordingly.
For an unknown reason (I cannot find anything in the change logs referencing this), only the total_ht field updates while, total_tva, total_localtax1, total_localtax2, and total_ttc remain unchanged after running an object->update with the updated amounts in the object.
CODE
The Trigger
case 'LINEBILL_MODIFY': $main_object=new Facture($this->db); $main_object->fetch($object->fk_facture); if ($main_object->array_options['options_isrental']) { $this->adjust_rental($action, $object, $main_object, $user, $langs, $conf); }; break;
The custom function:
`public function adjust_rental($action, $line_object, $main_object, User $user, Translate $langs, Conf $conf) {
}`
For additional context, rental_length is an extra_field that serves as an additional quantity field that we use for rental events. For example, we want to rent 4 boxes for 4 days, the updated_qty should be 16. I need to update the rest of the total fields in
Attached files
The custom fields on the invoice card:
The tooltip shows the correct amount in v. 19.0.3 after updating the fields as expected
The tooltip shows the incorrect amount in v. 20.0.0 after updating the fields