Skip to content

Commit

Permalink
Fix : in ODT show value and not label of company extrafield
Browse files Browse the repository at this point in the history
  • Loading branch information
jfefe committed Feb 17, 2013
1 parent d5f0eac commit a527949
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions htdocs/core/class/commondocgenerator.class.php
Expand Up @@ -164,14 +164,20 @@ function get_substitutionarray_thirdparty($object,$outputlangs)
'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;
}
Expand Down

0 comments on commit a527949

Please sign in to comment.