Fix: Import example file was wrong

This commit is contained in:
Laurent Destailleur 2011-06-07 10:36:30 +00:00
parent 8fe14361c3
commit 777c1ff575
2 changed files with 215 additions and 212 deletions

View File

@ -62,7 +62,7 @@ class ImportCsv extends ModeleImports
global $conf,$langs; global $conf,$langs;
$this->db = $db; $this->db = $db;
$this->separator=','; $this->separator=','; // Change also function cleansep
if (! empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE)) $this->separator=$conf->global->IMPORT_CSV_SEPARATOR_TO_USE; if (! empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE)) $this->separator=$conf->global->IMPORT_CSV_SEPARATOR_TO_USE;
$this->enclosure='"'; $this->enclosure='"';
$this->escape='"'; $this->escape='"';
@ -131,10 +131,7 @@ class ImportCsv extends ModeleImports
*/ */
function write_title_example($outputlangs,$headerlinefields) function write_title_example($outputlangs,$headerlinefields)
{ {
$func = function($value) { $s.=join($this->separator,array_map('cleansep',$headerlinefields));
return str_replace($this->separator,'/',$value);
};
$s.=join($this->separator,array_map($headerlinefields));
return $s."\n"; return $s."\n";
} }
@ -144,10 +141,7 @@ class ImportCsv extends ModeleImports
*/ */
function write_record_example($outputlangs,$contentlinevalues) function write_record_example($outputlangs,$contentlinevalues)
{ {
$func = function($value) { $s=join($this->separator,array_map('cleansep',$contentlinevalues));
return str_replace($this->separator,'/',$value);
};
$s=join($this->separator,array_map($contentlinevalues));
return $s."\n"; return $s."\n";
} }
@ -466,4 +460,12 @@ class ImportCsv extends ModeleImports
} }
/**
* Clean a string from separator
*/
function cleansep($value)
{
return str_replace(',','/',$value);
};
?> ?>

View File

@ -289,8 +289,9 @@ ExportCardToFormat=Export card to format
ContactNotLinkedToCompany=Contact not linked to any third party ContactNotLinkedToCompany=Contact not linked to any third party
DolibarrLogin=Dolibarr login DolibarrLogin=Dolibarr login
NoDolibarrAccess=No Dolibarr access NoDolibarrAccess=No Dolibarr access
ExportDataset_company_1=Companies/foundations and properties ExportDataset_company_1=Third parties (Companies/foundations) and properties
ExportDataset_company_2=Contacts and properties ExportDataset_company_2=Contacts and properties
ImportDataset_company_1=Third parties (Companies/foundations) and properties
PriceLevel=Price level PriceLevel=Price level
DeliveriesAddress=Delivery addresses DeliveriesAddress=Delivery addresses
DeliveryAddress=Delivery address DeliveryAddress=Delivery address