diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index fc4fd2010d4..9f02928db50 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -619,12 +619,13 @@ if ($step == 4 && $datatoexport) print ' '; print ''; - // test d'affichage du tableau excel - /* - print '
'; - viewExcelFileContent($conf->export->dir_temp.'/1/export_commande_1.xls',5); - print '
'; - */ + // test d'affichage du tableau excel et csv + + //print '
'; + //viewExcelFileContent($conf->export->dir_temp.'/1/export_commande_1.xls',5,3); + //viewCsvFileContent($conf->export->dir_temp.'/1/export_commande_1.csv',5); + //print '
'; + } diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index 83fc00eb1ff..b163df5ce63 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -3345,6 +3345,31 @@ function make_alpha_from_numbers($number) } } +/* + * \brief Affiche le contenu d'un fichier CSV sous forme de tableau + * \param file_to_include Fichier CSV ŕ afficher + * \param max_rows Nombre max de lignes ŕ afficher (0 = illimité) + */ +function viewCsvFileContent($file_to_include='',$max_rows=0) +{ + $fic = fopen($file_to_include, 'rb'); + $count = 0; + + print ''; + for ($ligne = fgetcsv($fic, 1024); (!feof($fic) && (($max_rows > 0)?($count<=$max_rows):1==1)); $ligne = fgetcsv($fic, 1024)) + { + print ''; + $j = sizeof($ligne); + for ($i = 0; $i < $j; $i++) + { + print ''; + } + print ''; + $count++; + } + print '
'.$ligne[$i].'
'; +} + /* * \brief Affiche le contenu d'un fichier Excel (avec les feuilles de calcul) sous forme de tableau * \param file_to_include Fichier Excel ŕ afficher