diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 8c8d79f742220d099fb2422e588ac0abfe1e3652..ec9ae1d2870ce46f3229eaf21f2b665c2bd7f5bd 100755 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -134,7 +134,7 @@ abstract class CommonDocGenerator $object->state=getState($object->state_code,0); } - return array( + $array_thirdparty = array( 'company_name'=>$object->name, 'company_email'=>$object->email, 'company_phone'=>$object->phone, @@ -163,6 +163,17 @@ abstract class CommonDocGenerator 'company_idprof6'=>$object->idprof6, 'company_note'=>$object->note ); + + $extrafields = array(); + if(is_array($object->array_options) && count($object->array_options)) + { + foreach($object->array_options as $key=>$label) + { + $extrafields['company_options_'.$key] = $label; + } + $array_thirdparty = array_merge($array_thirdparty,$extrafields); + } + return $array_thirdparty; } /** diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 0f5e7051010d50f08ed4e1ec5ac5a77c8ca9503c..28b38702fb9cd2666e046e00afcafeed22a13f1c 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -139,6 +139,8 @@ class Societe extends CommonObject var $logo; var $logo_small; var $logo_mini; + + var $array_options; var $oldcopy; @@ -852,6 +854,18 @@ class Societe extends CommonObject $this->import_key = $obj->import_key; $result = 1; + + // Retreive all extrafield for thirdparty + // fetch optionals attributes and labels + $extrafields=new ExtraFields($this->db); + $extralabels=$extrafields->fetch_name_optionals_label('company',true); + if (count($extralabels)>0) { + $this->array_options = array(); + } + foreach($extrafields->attribute_label as $key=>$label) + { + $this->array_options[$key]=$label; + } } else {