Merge branch 'extra_odt' into fgd

This commit is contained in:
jfefe 2013-02-16 03:42:20 +01:00
commit 9d70a8b1c5
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);
}
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;
}
/**

View File

@ -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
{