From ec8baa6bff9b921e3591036ac22d340017369e39 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Mon, 8 Mar 2021 10:00:19 +0100 Subject: [PATCH] Update commondocgenerator.class.php #16341 --- htdocs/core/class/commondocgenerator.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 03a5154f23f..ec05ad5d98d 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -798,6 +798,15 @@ abstract class CommonDocGenerator $resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key, $outputlangs); + // Load product data optional fields to the line -> enables to use "line_product_options_{extrafield}" + if (isset($line->fk_product) && $line->fk_product > 0) + { + $tmpproduct = new Product($this->db); + $result = $tmpproduct->fetch($line->fk_product); + foreach ($tmpproduct->array_options as $key=>$label) + $resarray["line_product_".$key] = $label; + } + return $resarray; }