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
This commit is contained in:
Gerhard Stephan 2018-02-12 21:38:51 +01:00
parent fda5822d5a
commit 2aaf3a466d

View File

@ -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;
}