FIX : export extrafields must not include separe type

This commit is contained in:
florian HENRY 2016-12-02 12:02:08 +01:00
parent 191474a5db
commit de5ad57af4

View File

@ -15,36 +15,38 @@ if ($resql) // This can fail when class is used on old database (during migra
{ {
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$fieldname=$keyforaliasextra.'.'.$obj->name; if ($obj->type!='separate') {
$fieldlabel=ucfirst($obj->label); $fieldname=$keyforaliasextra.'.'.$obj->name;
$typeFilter="Text"; $fieldlabel=ucfirst($obj->label);
switch($obj->type) $typeFilter="Text";
{ switch($obj->type)
case 'int': {
case 'double': case 'int':
case 'price': case 'double':
$typeFilter="Numeric"; case 'price':
break; $typeFilter="Numeric";
case 'date': break;
case 'datetime': case 'date':
$typeFilter="Date"; case 'datetime':
break; $typeFilter="Date";
case 'boolean': break;
$typeFilter="Boolean"; case 'boolean':
break; $typeFilter="Boolean";
case 'sellist': break;
$tmp=''; case 'sellist':
$tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null $tmp='';
if ($tmpparam['options'] && is_array($tmpparam['options'])) { $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
$tmpkeys=array_keys($tmpparam['options']); if ($tmpparam['options'] && is_array($tmpparam['options'])) {
$tmp=array_shift($tmpkeys); $tmpkeys=array_keys($tmpparam['options']);
} $tmp=array_shift($tmpkeys);
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; }
break; if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]=$keyforelement;
} }
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]=$keyforelement;
} }
} }
// End add axtra fields // End add axtra fields