From 06962cb4e6de35ac7ffde6b239347ebe887c71b2 Mon Sep 17 00:00:00 2001 From: phf Date: Tue, 23 Jun 2015 16:26:05 +0200 Subject: [PATCH] FIX : tool export handle the type "select" extrafields and return the value instead of id --- htdocs/core/modules/export/export_csv.modules.php | 7 +++++++ htdocs/core/modules/export/export_excel.modules.php | 9 ++++++++- htdocs/core/modules/export/export_tsv.modules.php | 9 ++++++++- htdocs/core/modules/modSociete.class.php | 3 +++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index ce058a93455..58f4f036d5e 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -252,6 +252,13 @@ class ExportCsv extends ModeleExports $newvalue=$this->csv_clean($newvalue,$outputlangs->charset_output); + if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) + { + $array = unserialize($typefield); + $array = $array['options']; + $newvalue = $array[$newvalue]; + } + fwrite($this->handle,$newvalue.$this->separator); $this->col++; } diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php index 46ab465f42e..6cad56f07bb 100644 --- a/htdocs/core/modules/export/export_excel.modules.php +++ b/htdocs/core/modules/export/export_excel.modules.php @@ -305,7 +305,14 @@ class ExportExcel extends ModeleExports $newvalue=$this->excel_clean($newvalue); $typefield=isset($array_types[$code])?$array_types[$code]:''; - + + if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) + { + $array = unserialize($typefield); + $array = $array['options']; + $newvalue = $array[$newvalue]; + } + // Traduction newvalue if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) { diff --git a/htdocs/core/modules/export/export_tsv.modules.php b/htdocs/core/modules/export/export_tsv.modules.php index 409102fd857..a077cc1772e 100644 --- a/htdocs/core/modules/export/export_tsv.modules.php +++ b/htdocs/core/modules/export/export_tsv.modules.php @@ -226,7 +226,14 @@ class ExportTsv extends ModeleExports if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) $newvalue=$outputlangs->transnoentities($reg[1]); $newvalue=$this->tsv_clean($newvalue,$outputlangs->charset_output); - + + if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) + { + $array = unserialize($typefield); + $array = $array['options']; + $newvalue = $array[$newvalue]; + } + fwrite($this->handle,$newvalue.$this->separator); $this->col++; } diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 4367aae3789..ea77a39e21b 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -355,6 +355,9 @@ class modSociete extends DolibarrModules case 'sellist': $typeFilter="List:".$obj->param; break; + case 'select': + $typeFilter="Select:".$obj->param; + break; } $this->export_fields_array[$r][$fieldname]=$fieldlabel; $this->export_TypeFields_array[$r][$fieldname]=$typeFilter;