瀏覽代碼

Export.php - fixed a regression (specifying no field list resulting in an error)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1484 a333f486-631f-4898-b8df-5754b55c2be0
romainq 13 年之前
父節點
當前提交
bb4ad5e6a2
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      webservices/export.php

+ 7 - 2
webservices/export.php

@@ -48,9 +48,14 @@ $sFormat = strtolower(utils::ReadParam('format', 'html'));
 
 $sFields = utils::ReadParam('fields', '', true, 'raw_data'); // CSV field list (allows to specify link set attributes, still not taken into account for XML export)
 $aFields = explode(',', $sFields);
-foreach($aFields as &$sField)
+// Clean the list of columns (empty it if every string is empty)
+foreach($aFields as $index => $sField)
 {
-	$sField = trim($sField);
+	$aFields[$index] = trim($sField);
+	if(strlen($aFields[$index]) == 0)
+	{
+		unset($aFields[$index]);
+	}
 }
 
 $oP = null;