From 8ebb48cb5c9464865306c33cfec48bea86568398 Mon Sep 17 00:00:00 2001 From: jfefe <jfefe@aternatik.fr> Date: Sun, 17 Feb 2013 21:14:00 +0100 Subject: [PATCH] Fix : in ODT show value and not label of company extrafield --- htdocs/core/class/commondocgenerator.class.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index d64a7c2710b..3b815e962c0 100755 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -164,14 +164,20 @@ abstract class CommonDocGenerator 'company_note'=>$object->note ); - $extrafields = array(); + // Retrieve extrafields if(is_array($object->array_options) && count($object->array_options)) { - foreach($object->array_options as $key=>$label) + if(!class_exists('Extrafields')) + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + $extralabels = $extrafields->fetch_name_optionals_label('company',true); + //Get extrafield values + $object->fetch_optionals($object->id,$extralabels); + + foreach($extrafields->attribute_label as $key=>$label) { - $extrafields['company_'.$key] = $label; + $array_thirdparty=array_merge($array_thirdparty,array('company_options_'.$key => $object->array_options['options_'.$key])); } - $array_thirdparty = array_merge($array_thirdparty,$extrafields); } return $array_thirdparty; } -- GitLab