From f1d1522478e7971a5fcf5f9cc2d725014948f32e Mon Sep 17 00:00:00 2001 From: jfefe Date: Thu, 9 Jan 2014 01:49:59 +0100 Subject: [PATCH 1/2] Fix : when using several field for label into sellist extrafields traduction is not needed. Without this, the list display "not defined". The key can't exists because label displayed is build from several field so we show raw data --- htdocs/core/class/extrafields.class.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 39916775507..b68e395580a 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -753,6 +753,7 @@ class ExtraFields $fields_label = explode('|',$InfoFieldList[1]); if(is_array($fields_label)) { + $notrans = true; foreach ($fields_label as $field_toshow) { $labeltoshow.= $obj->$field_toshow.' '; @@ -778,12 +779,15 @@ class ExtraFields } else { - $translabel=$langs->trans($obj->$InfoFieldList[1]); - if ($translabel!=$obj->$InfoFieldList[1]) { - $labeltoshow=dol_trunc($translabel,18); - } - else { - $labeltoshow=dol_trunc($obj->$InfoFieldList[1],18); + if(!$notrans) + { + $translabel=$langs->trans($obj->$InfoFieldList[1]); + if ($translabel!=$obj->$InfoFieldList[1]) { + $labeltoshow=dol_trunc($translabel,18); + } + else { + $labeltoshow=dol_trunc($obj->$InfoFieldList[1],18); + } } if (empty($labeltoshow)) $labeltoshow='(not defined)'; if ($value==$obj->rowid) From 77a1d6a43a4f8b38271e23da00a8dfbb42d8c284 Mon Sep 17 00:00:00 2001 From: jfefe Date: Thu, 9 Jan 2014 02:40:34 +0100 Subject: [PATCH 2/2] Bad value display when using several label into sellist extrafield --- htdocs/core/class/extrafields.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index b68e395580a..22b159cbe3d 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -958,11 +958,11 @@ class ExtraFields { foreach ($fields_label as $field_toshow) { - $translabel=$langs->trans($obj->$InfoFieldList[1]); - if ($translabel!=$obj->$InfoFieldList[1]) { - $value=dol_trunc($translabel,18).' '; + $translabel=$langs->trans($field_toshow); + if ($translabel!=$field_toshow) { + $value.=dol_trunc($translabel,18).' '; }else { - $value=$obj->$InfoFieldList[1].' '; + $value.=$obj->$field_toshow.' '; } } }