Selaa lähdekoodia

CSV import (both std and related to the data synchro) can be used with a tab (keyword 'tab', case insensitive)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1737 a333f486-631f-4898-b8df-5754b55c2be0
romainq 13 vuotta sitten
vanhempi
commit
08f30cc794
2 muutettua tiedostoa jossa 12 lisäystä ja 2 poistoa
  1. 6 1
      synchro/synchro_import.php
  2. 6 1
      webservices/import.php

+ 6 - 1
synchro/synchro_import.php

@@ -104,7 +104,7 @@ $aPageParams = array
 		'mandatory' => false,
 		'modes' => 'http,cli',
 		'default' => ';',
-		'description' => 'column separator in CSV data',
+		'description' => 'column separator in CSV data (1 char, or \'tab\')',
 	),
 	'qualifier' => array
 	(
@@ -317,6 +317,11 @@ try
 	$sComment = ReadParam($oP, 'comment', 'raw_data');
 	$sNoStopOnImportError = ReadParam($oP, 'no_stop_on_import_error');
 
+	if (strtolower(trim($sSep)) == 'tab')
+	{
+		$sSep = "\t";
+	}
+
 	$oLoadStartDate = new DateTime(); // Now
 
    // Note about date formatting: These MySQL settings are read-only... and in fact unused :-(

+ 6 - 1
webservices/import.php

@@ -102,7 +102,7 @@ $aPageParams = array
 		'mandatory' => false,
 		'modes' => 'http,cli',
 		'default' => ',',
-		'description' => 'column separator in CSV data',
+		'description' => 'column separator in CSV data (1 char, or \'tab\')',
 	),
 	'qualifier' => array
 	(
@@ -283,6 +283,11 @@ try
 	$sSimulate = ReadParam($oP, 'simulate');
 	$sComment = ReadParam($oP, 'comment', 'raw_data');
 
+	if (strtolower(trim($sSep)) == 'tab')
+	{
+		$sSep = "\t";
+	}
+
 	//////////////////////////////////////////////////
 	//
 	// Check parameters format/consistency