From b3ca9de39947ecdc77dcc35142174db7797963ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 02:09:34 +0200 Subject: [PATCH] Fix: Update select with list --- htdocs/core/modules/modSociete.class.php | 54 +++++++++---------- .../core/tpl/admin_extrafields_edit.tpl.php | 14 ++--- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 93700ec55b2..0f2e7ed5bb6 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -258,33 +258,33 @@ class modSociete extends DolibarrModules $resql=$this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { - while ($obj=$this->db->fetch_object($resql)) - { - $fieldname='extra.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $typeFilter="Text"; - switch($obj->type) - { - case 'int': - case 'double': - case 'price': - $typeFilter="Numeric"; - break; - case 'date': - case 'datetime': - $typeFilter="Date"; - break; - case 'boolean': - $typeFilter="Boolean"; - break; - case 'sellist': - $typeFilter="List:".$obj->param; - break; - } - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; - $this->export_entities_array[$r][$fieldname]='company'; - } + while ($obj=$this->db->fetch_object($resql)) + { + $fieldname='extra.'.$obj->name; + $fieldlabel=ucfirst($obj->label); + $typeFilter="Text"; + switch($obj->type) + { + case 'int': + case 'double': + case 'price': + $typeFilter="Numeric"; + break; + case 'date': + case 'datetime': + $typeFilter="Date"; + break; + case 'boolean': + $typeFilter="Boolean"; + break; + case 'sellist': + $typeFilter="List:".$obj->param; + break; + } + $this->export_fields_array[$r][$fieldname]=$fieldlabel; + $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; + $this->export_entities_array[$r][$fieldname]='company'; + } } // End add axtra fields $this->export_sql_start[$r]='SELECT DISTINCT '; diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 25c8ede2227..3d1bdc4a9be 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -61,12 +61,14 @@ if((($type == 'select') || ($type == 'checkbox') ||(($type == 'radio'))) && is_a $param_chain = ''; foreach ($param['options'] as $key => $value) { - if(strlen($key)) + if(strlen($key)) { - $param_chain .= $key.', '.$value."\n"; + $param_chain .= $key.','.$value."\n"; } } -}elseif ($type== 'sellist') { +} +elseif ($type== 'sellist') +{ $paramlist=array_keys($param['options']); $param_chain = $paramlist[0]; } @@ -83,8 +85,8 @@ if((($type == 'select') || ($type == 'checkbox') ||(($type == 'radio'))) && is_a - @@ -99,7 +101,7 @@ if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') ||(($typ -