Skip to content

Commit

Permalink
Merge pull request #3086 from atm-ph/3.6_fix_export_extrafield_select
Browse files Browse the repository at this point in the history
FIX : tool export extrafields
  • Loading branch information
eldy committed Jun 27, 2015
2 parents e72c118 + 06962cb commit 461b5f0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
7 changes: 7 additions & 0 deletions htdocs/core/modules/export/export_csv.modules.php
Expand Up @@ -252,6 +252,13 @@ function write_record($array_selected_sorted,$objp,$outputlangs,$array_types)

$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++;
}
Expand Down
9 changes: 8 additions & 1 deletion htdocs/core/modules/export/export_excel.modules.php
Expand Up @@ -305,7 +305,14 @@ function write_record($array_selected_sorted,$objp,$outputlangs,$array_types)

$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))
{
Expand Down
9 changes: 8 additions & 1 deletion htdocs/core/modules/export/export_tsv.modules.php
Expand Up @@ -226,7 +226,14 @@ function write_record($array_selected_sorted,$objp,$outputlangs,$array_types)
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++;
}
Expand Down
3 changes: 3 additions & 0 deletions htdocs/core/modules/modSociete.class.php
Expand Up @@ -355,6 +355,9 @@ function __construct($db)
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;
Expand Down

0 comments on commit 461b5f0

Please sign in to comment.