From 7a572cd1d3e56c7d1d154db20355f5bbc2696eee Mon Sep 17 00:00:00 2001 From: ATM-NicolasV <92087862+ATM-NicolasV@users.noreply.github.com> Date: Mon, 4 May 2026 12:57:51 +0200 Subject: [PATCH 1/3] FIX product price.php: preserve default_vat_code and tva_npr when auto-creating initial product_price row (#38034) 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. --- htdocs/product/price.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index dcb86da3588..d5aed441828 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -2766,9 +2766,9 @@ if ((!getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || $action == 'showlog_defau // We add it to fix this if not (trouble with old versions) // We emulate the change of the price from interface with the same value than the one into table llx_product if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { - $ret = $object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1); + $ret = $object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1, 0, 0, 0, array(), $object->default_vat_code); } else { - $ret = $object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min)); + $ret = $object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min), 0, $object->tva_npr, 0, 0, array(), $object->default_vat_code); } if ($ret < 0) { From 4861151c929174267dfeb814c4286628b16521f9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 4 May 2026 13:10:20 +0200 Subject: [PATCH 2/3] FIX #38074 (#38075) --- htdocs/asset/class/asset.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index a9fa58ad208..d2c71880b50 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -748,7 +748,7 @@ class Asset extends CommonObject } $sql = "SELECT ad.rowid, ad.depreciation_mode, ad.ref, ad.depreciation_date, ad.depreciation_ht, ad.cumulative_depreciation_ht,"; - $sql .= " " . $this->db->ifsql('EXISTS (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type = \'asset\' AND ab.fk_docdet = ad.rowid)', '1', '0') . " AS bookkeeping"; + $sql .= " " . $this->db->ifsql('EXISTS (SELECT fk_docdet FROM ' . MAIN_DB_PREFIX . 'accounting_bookkeeping as ab WHERE ab.doc_type = \'asset\' AND ab.fk_docdet = ad.rowid)', '1', '0') . " AS bookkeeping"; $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad"; $sql .= " WHERE ad.fk_asset = " . (int) $this->id; $sql .= " ORDER BY ad.depreciation_date ASC"; From 3de2fa834a0b44d2fe955590f98cd180a542f77b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 May 2026 18:20:25 +0200 Subject: [PATCH 3/3] Fix typo --- htdocs/public/members/new.php | 2 +- htdocs/public/payment/newpayment.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 174c4db8f88..9dd6c7a9911 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -1006,7 +1006,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR if (getDolGlobalString('MEMBER_NEWFORM_DOLIBARRTURNOVER')) { // Do not set a default amount MEMBER_NEWFORM_AMOUNT if you use MEMBER_NEWFORM_DOLIBARRTURNOVER $s = $langs->trans("AreYouAPreferredPartner", '{s1}'); - $s = str_replace('{s1}', 'Peferred Partner', $s); + $s = str_replace('{s1}', 'Preferred Partner', $s); print ''; print ''; print ''; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 670634e79cf..d2e935c2501 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1836,7 +1836,7 @@ if ($source == 'member' || $source == 'membersubscription') { // Do not set a default amount MEMBER_NEWFORM_AMOUNT if you use MEMBER_NEWFORM_DOLIBARRTURNOVER $s = $langs->trans("AreYouAPreferredPartner", '{s1}'); - $s = str_replace('{s1}', 'Peferred Partner', $s); + $s = str_replace('{s1}', 'Preferred Partner', $s); print ''; print ''; print '';