From 6c6c854eae8553c7abb416dfb53caeb7f1d0ff70 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 15 Feb 2022 10:23:43 +0100 Subject: [PATCH 1/4] fix parent line on create with origin --- htdocs/commande/card.php | 2 +- htdocs/compta/facture/card.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e00ff6a1763..640b990a3cb 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -401,7 +401,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/card.php b/htdocs/compta/facture/card.php index d3e5a0062b0..a219da84bd4 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1220,7 +1220,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; } } @@ -1666,7 +1666,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; } } From 01ef9b64eebecc2660495a48a74bb7fd5b369a55 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 15 Feb 2022 10:34:10 +0100 Subject: [PATCH 2/4] fix parent line on create with no originid --- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 53bf6dd29f2..983e3ae8205 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1054,7 +1054,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/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 63a7b2f8e21..4caa61e1aad 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -790,7 +790,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; } } From 288c58e533fe10186c3a83d6ac89ab1d96d3370f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 15 Feb 2022 10:41:21 +0100 Subject: [PATCH 3/4] fix parent line on propal --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 3766c7ba1a1..907236b8b9a 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1213,7 +1213,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; } } From ebada46a07c48705ffcc662a70758005561e2281 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 15 Feb 2022 12:14:48 +0100 Subject: [PATCH 4/4] fix context for createfromclone --- htdocs/compta/facture/class/facture.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 4caa61e1aad..55471afeccf 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -755,6 +755,9 @@ class Facture extends CommonInvoice 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;