FIX product price.php: preserve default_vat_code and tva_npr when aut…#38034
Open
ATM-NicolasV wants to merge 1 commit intoDolibarr:23.0from
Open
Conversation
…o-creating initial product_price row When a product has no row in llx_product_price (typical for products imported in bulk where only llx_product was populated), price.php auto-creates an initial history line on first display of the price tab (branch starting at "We must have at least one initial line"). The two updatePrice() calls in this branch omitted parameter 11 (\$newdefaultvatcode) which defaults to ''. In Product::updatePrice() the SQL then writes default_vat_code = NULL in BOTH llx_product and the new llx_product_price row, silently wiping a correctly-stored VAT code on every first display. Symptom: "ErrorBadValueForParamNotAString" rendered next to selling price/min selling price (because \$langs->trans(\$object->price_base_type) is called with NULL when the row is freshly created with empty fields), and default_vat_code persistently reset to NULL until the user manually re-saves through the form. Fix: forward \$object->default_vat_code (and \$object->tva_npr for the non-multiprice branch) to updatePrice() so the auto-init preserves the product's VAT configuration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
preserve default_vat_code and tva_npr when auto-creating initial product_price row
When a product has no row in llx_product_price (typical for products imported in bulk where only llx_product was populated), price.php auto-creates an initial history line on first display of the price tab (branch starting at "We must have at least one initial line").
The two updatePrice() calls in this branch omitted parameter 11 ($newdefaultvatcode) which defaults to ''. In Product::updatePrice() the SQL then writes default_vat_code = NULL in BOTH llx_product and the new llx_product_price row, silently wiping a correctly-stored VAT code on every first display.
Symptom: "ErrorBadValueForParamNotAString" rendered next to selling price/min selling price (because $langs->trans($object->price_base_type) is called with NULL when the row is freshly created with empty fields), and default_vat_code persistently reset to NULL until the user manually re-saves through the form.
Fix: forward $object->default_vat_code (and $object->tva_npr for the non-multiprice branch) to updatePrice() so the auto-init preserves the product's VAT configuration.
Instructions
This is a template to help you make good pull requests. You may use Github Markdown syntax to format your issue report.
Please: