From 93a53c4aea7beb9594b98e9cd8301054cbc2a79c Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Tue, 31 May 2022 12:20:41 +0300 Subject: [PATCH] Fix issue #21063 --- .../fourn/class/fournisseur.facture.class.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 0630d2df6a4..948e1c01deb 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2354,14 +2354,6 @@ class FactureFournisseur extends CommonInvoice $info_bits = 0; } - if ($idproduct) { - $product = new Product($this->db); - $result = $product->fetch($idproduct); - $product_type = $product->type; - } else { - $product_type = $type; - } - //Fetch current line from the database and then clone the object and set it in $oldline property $line = new SupplierInvoiceLine($this->db); $line->fetch($id); @@ -2369,6 +2361,15 @@ class FactureFournisseur extends CommonInvoice $staticline = clone $line; + if ($idproduct) { + $product = new Product($this->db); + $result = $product->fetch($idproduct); + $product_type = $product->type; + } else { + $idproduct = $staticline->fk_product; + $product_type = $type; + } + $line->oldline = $staticline; $line->context = $this->context;