FIX: accountancy sales/purchases journal: sql error logged when no invoice in journal #34339
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
FIX: accountancy sales/purchases journal: sql error logged when no invoice in journal
In purchases and sales journal, when checking if some lines are not bound in the selected invoices, an SQL error occurs if no invoices are selected (this generates an SQL statement with
AND fk_facture IN ()
).A simple check on array
$tabfac
being empty clears the error and has the added benefit of suppressing one superfluous SQL query.And while fixing that, I discovered the check was not working for sales invoice as a copy/paste made in so that an incorrect sql result column was used (
$obj->fk_facture_fourn
instead of$obj->fk_facture)
.