Retrieve extrafields when fetch thirparty

Work on extrafields support in thirpdparty ODT document
This commit is contained in:
jfefe 2013-02-16 03:41:11 +01:00
parent 91215a075a
commit fa53147d0a
2 changed files with 26 additions and 1 deletions

View File

@ -134,7 +134,7 @@ abstract class CommonDocGenerator
$object->state=getState($object->state_code,0); $object->state=getState($object->state_code,0);
} }
return array( $array_thirdparty = array(
'company_name'=>$object->name, 'company_name'=>$object->name,
'company_email'=>$object->email, 'company_email'=>$object->email,
'company_phone'=>$object->phone, 'company_phone'=>$object->phone,
@ -163,6 +163,17 @@ abstract class CommonDocGenerator
'company_idprof6'=>$object->idprof6, 'company_idprof6'=>$object->idprof6,
'company_note'=>$object->note '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;
} }
/** /**

View File

@ -140,6 +140,8 @@ class Societe extends CommonObject
var $logo_small; var $logo_small;
var $logo_mini; var $logo_mini;
var $array_options;
var $oldcopy; var $oldcopy;
/** /**
@ -852,6 +854,18 @@ class Societe extends CommonObject
$this->import_key = $obj->import_key; $this->import_key = $obj->import_key;
$result = 1; $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 else
{ {