From 79cacf58c25fa1383d5d3908df68a55a05ffb497 Mon Sep 17 00:00:00 2001 From: avolani <31508728+avolani@users.noreply.github.com> Date: Tue, 16 May 2023 16:53:58 +0200 Subject: [PATCH 1/2] Update propal.class.php Fix IDs on created proposal lines when cloning so the hook createFrom has all the clone infos --- htdocs/comm/propal/class/propal.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index d71e4a93c2f..4b0edfc933e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1264,6 +1264,10 @@ class Propal extends CommonObject dol_print_error($this->db); break; } + + // Set the id on created row + $line->id = $result; + // Defined the new fk_parent_line if ($result > 0 && $line->product_type == 9) { $fk_parent_line = $result; @@ -1397,6 +1401,9 @@ class Propal extends CommonObject } foreach ($object->lines as $line) { + + $line->id = 0; + if ($line->fk_product > 0) { $prod = new Product($this->db); $res = $prod->fetch($line->fk_product); From 2c97b66c24d55bea4e1848214e066cb2e72809bb Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 16 May 2023 14:57:46 +0000 Subject: [PATCH 2/2] Fixing style errors. --- htdocs/comm/propal/class/propal.class.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 4b0edfc933e..ce9810b3702 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1264,10 +1264,10 @@ class Propal extends CommonObject dol_print_error($this->db); break; } - - // Set the id on created row - $line->id = $result; - + + // Set the id on created row + $line->id = $result; + // Defined the new fk_parent_line if ($result > 0 && $line->product_type == 9) { $fk_parent_line = $result; @@ -1401,9 +1401,8 @@ class Propal extends CommonObject } foreach ($object->lines as $line) { - - $line->id = 0; - + $line->id = 0; + if ($line->fk_product > 0) { $prod = new Product($this->db); $res = $prod->fetch($line->fk_product);