From 0a71c84bf438dfe8bf0670237d18a7c6ae2c43fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Apr 2013 23:08:07 +0200 Subject: [PATCH] Fix: Remove separator files. --- htdocs/core/modules/import/import_csv.modules.php | 8 ++++---- test/phpunit/FilesLibTest.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 60fa38effc0..90a0da8b7b3 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -176,7 +176,7 @@ class ImportCsv extends ModeleImports */ function write_title_example($outputlangs,$headerlinefields) { - $s.=join($this->separator,array_map('cleansep',$headerlinefields)); + $s=join($this->separator,array_map('cleansep',$headerlinefields)); return $s."\n"; } @@ -636,12 +636,12 @@ class ImportCsv extends ModeleImports /** * Clean a string from separator * - * @param string $value Remove separator - * @return string String without separator + * @param string $value Remove standard separators + * @return string String without separators */ function cleansep($value) { - return str_replace(',','/',$value); + return str_replace(array(',',';'),'/',$value); }; /** diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index 771635f34eb..54ed69216ac 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -345,12 +345,12 @@ class FilesLibTest extends PHPUnit_Framework_TestCase // Test copy with special char / delete with blob $result=dol_copy($file, $conf->admin->dir_temp.'/file with [x] and é.csv',0,1); print __METHOD__." result=".$result."\n"; - $this->assertGreaterThanOrEqual(1,$result,'copy destination already exists, overwrite'); // Should be 1 + $this->assertGreaterThanOrEqual(1,$result,'copy file with special chars, overwrite'); // Should be 1 // Try to delete using a glob criteria $result=dol_delete_file($conf->admin->dir_temp.'/file with [x]*é.csv'); print __METHOD__." result=".$result."\n"; - $this->assertTrue($result,'delete file that does not exists'); + $this->assertTrue($result,'delete file using glob'); } /**