From 2aaf3a466d97b6898047bbde05f3f5ad50519e8d Mon Sep 17 00:00:00 2001 From: Gerhard Stephan Date: Mon, 12 Feb 2018 21:38:51 +0100 Subject: [PATCH] Load product data optional fields to the line -> enables to use "line_options_{extrafield}" This fixes the issue #3185 https://github.com/Dolibarr/dolibarr/issues/3185 --- htdocs/core/class/commondocgenerator.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 666011b3f4a..dee67990cdc 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -527,7 +527,13 @@ abstract class CommonDocGenerator $line->fetch_optionals($line->rowid,$extralabels); $resarray = $this->fill_substitutionarray_with_extrafields($line,$resarray,$extrafields,$array_key=$array_key,$outputlangs); - + + // Load product data optional fields to the line -> enables to use "line_options_{extrafield}" + $product = new Product($this->db); + $result = $product->fetch(null, $line->product_ref); + foreach($product->array_options as $key=>$label) + $resarray["line_".$key] = $label; + return $resarray; }