Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Critical Bug: Bugfix for Taxes Deleted from Vendor Invoices #25704

Closed
qaOYR opened this issue Aug 28, 2023 · 2 comments
Closed

Critical Bug: Bugfix for Taxes Deleted from Vendor Invoices #25704

qaOYR opened this issue Aug 28, 2023 · 2 comments
Labels
Bug This is a bug (something does not work as expected)

Comments

@qaOYR
Copy link

qaOYR commented Aug 28, 2023

Bug

In Spain, we use the field localtax2 for a type of tax (IRPF) that needs to be withheld and accounted for in some vendor invoices.

The tax is properly applied to vendor invoices, but is then deleted from these invoices if the "Label" field of vendor invoices is added or edited after the invoice has been validated.

Environment Version

17.0.3

Environment OS

No response

Environment Web server

Version Apache/2.4.41 (Ubuntu)

Environment PHP

7.4.33 and 8.1 (tested both)

Environment Database

MariaDB 5.5.5-10.3.38

Environment URL(s)

dolibarr/fourn/facture/card.php

Expected and actual behavior

When creating or editing a label of a vendor invoice, that field should be edited without any other change to existing invoice.

What actually happens is that "localtax2" taxes are deleted from invoice.

We have fixed the error by doing the following:

Find line 437 of the file: htdocs/fourm/facture/card.php

} elseif ($action == 'setlabel' && $usercancreate){ $object->fetch($id);

And add the following code right after the above line to correct the issue:

$object->localtax2=$object->total_localtax2;

The problem seems to be that when the page is loaded for editing, the variable localtax does not load any value (NULL) and instead the following nonexisting variable is used: total_localtax2.

The update of the field is actually carried out in the database field localtal2, not with total_localtax2 as Dolibarr is wrongly using.

If our analysis is wrong or if you find a more elegant way to solve it, we are all ears.

We would appreciate it if our fix or a better one could be included in future releases as wrong taxes are a total showstopper.

Steps to reproduce the behavior

Edit any vendor invoice that has localtax2 taxes after it has been validated.

Attached files

No response

@qaOYR qaOYR added the Bug This is a bug (something does not work as expected) label Aug 28, 2023
@qaOYR
Copy link
Author

qaOYR commented Sep 7, 2023

Dear Dolibarr Devs,

We have tested against the latest released code 18.0.1 and the reported error still persists.

Likewise, we have tested that our proposed bugfix remains valid for Dolibarr 18.01

We have spent quite a bit of time tracking down this issue and finding a fix and would appreciate some feedback on the proposed fix that we would hope to see included with future versions of Dolibarr.

If we are not communicating our fixes properly, we would love to hear about it too.

Thanks.

@qaOYR qaOYR changed the title Critical Bug: Taxes deleted from Vendor Invoices and bugfix Critical Bug: Bugfix for Taxes Deleted from Vendor Invoices Sep 7, 2023
simnandez pushed a commit to simnandez/dolibarr that referenced this issue Sep 11, 2023
simnandez pushed a commit to simnandez/dolibarr that referenced this issue Sep 11, 2023
simnandez pushed a commit to simnandez/dolibarr that referenced this issue Sep 11, 2023
@qaOYR
Copy link
Author

qaOYR commented Sep 26, 2023

@simnandez

We have tested the proposed fix against the latest 18.01 code and it does work, so this bug report can be closed as far as we are concerned.

@qaOYR qaOYR closed this as completed Sep 26, 2023
eldy added a commit that referenced this issue Nov 7, 2024
* FIX #25853 Thirdparty Massaction

* FIX #25704 Taxes Deleted from Vendor Invoices

* FIX #25704 Taxes Deleted from Vendor Invoices

* FIX #25704 Taxes Deleted from Vendor Invoices

* Update fournisseur.facture.class.php

---------

Co-authored-by: Juanjo Menent <jmenent@2byte.es>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug (something does not work as expected)
Projects
None yet
Development

No branches or pull requests

1 participant