diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 1c532e26147..f3cd56a8f7c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1248,7 +1248,7 @@ class Propal extends CommonObject break; } // Defined the new fk_parent_line - if ($result > 0 && $line->product_type == 9) { + if ($result > 0) { $fk_parent_line = $result; } } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 958ff542fed..72851c3943a 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -421,7 +421,7 @@ if (empty($reshook)) { } // Defined the new fk_parent_line - if ($result > 0 && $lines[$i]->product_type == 9) { + if ($result > 0) { $fk_parent_line = $result; } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c315a4fcd61..af251af4264 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1056,7 +1056,7 @@ class Commande extends CommonOrder return -1; } // Defined the new fk_parent_line - if ($result > 0 && $line->product_type == 9) { + if ($result > 0) { $fk_parent_line = $result; } } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 4b85545346b..1e2f521e3d9 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1270,7 +1270,7 @@ if (empty($reshook)) { $object->lines[] = $line; // insert new line in current object // Defined the new fk_parent_line - if ($result > 0 && $line->product_type == 9) { + if ($result > 0) { $fk_parent_line = $result; } } @@ -1781,7 +1781,7 @@ if (empty($reshook)) { } // Defined the new fk_parent_line - if ($result > 0 && $lines[$i]->product_type == 9) { + if ($result > 0) { $fk_parent_line = $result; } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index cc722bafca3..81ba4f4be2a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -788,6 +788,9 @@ class Facture extends CommonInvoice dol_syslog("There is ".count($this->lines)." lines that are invoice lines objects"); foreach ($this->lines as $i => $val) { $newinvoiceline = $this->lines[$i]; + + $newinvoiceline->context = $this->context; + $newinvoiceline->fk_facture = $this->id; $newinvoiceline->origin = $this->lines[$i]->element; @@ -820,7 +823,7 @@ class Facture extends CommonInvoice $result = $newinvoiceline->insert(); // Defined the new fk_parent_line - if ($result > 0 && $newinvoiceline->product_type == 9) { + if ($result > 0) { $fk_parent_line = $result; } }