From 6a2616c1190af829bee406a65d39e18e8cf481ae Mon Sep 17 00:00:00 2001 From: atm-corentin Date: Wed, 5 Mar 2025 14:58:21 +0100 Subject: [PATCH] set field default vat code because it was not set for child product --- htdocs/product/class/product.class.php | 3 ++- htdocs/variants/class/ProductCombination.class.php | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 88ab82da615..cf3bf8360e2 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1121,6 +1121,7 @@ class Product extends CommonObject $sql .= ", batch_mask"; $sql .= ", fk_unit"; $sql .= ", mandatory_period"; + if (!empty($this->default_vat_code)) $sql.=", default_vat_code"; $sql .= ") VALUES ("; $sql .= "'".$this->db->idate($this->date_creation)."'"; $sql .= ", ".(!empty($this->entity) ? (int) $this->entity : (int) $conf->entity); @@ -1152,8 +1153,8 @@ class Product extends CommonObject $sql .= ", '".$this->db->escape($this->batch_mask)."'"; $sql .= ", ".($this->fk_unit > 0 ? ((int) $this->fk_unit) : 'NULL'); $sql .= ", '".$this->db->escape((string) $this->mandatory_period)."'"; + if (!empty($this->default_vat_code)) $sql.=", '".$this->db->escape($this->default_vat_code)."'"; $sql .= ")"; - dol_syslog(get_class($this)."::Create", LOG_DEBUG); $result = $this->db->query($sql); diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 088a56488a4..ec69ab242df 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -577,7 +577,6 @@ class ProductCombination } else { $new_price += $variation_price; } - $ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code); if ($ret < 0) { @@ -607,7 +606,7 @@ class ProductCombination $new_price += $this->variation_price; } - $ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq); + $ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq,0, array(), $parent->default_vat_code); if ($ret < 0) { $this->db->rollback();