diff --git a/htdocs/document.php b/htdocs/document.php
index 7358d4ea708..44abced1b35 100644
--- a/htdocs/document.php
+++ b/htdocs/document.php
@@ -78,15 +78,22 @@ else $type=dol_mimetype($original_file);
// Define attachment (attachment=true to force choice popup 'open'/'save as')
$attachment = true;
+// Documents
+if (eregi('\.doc$',$original_file)) { $attachment = true; }
+if (eregi('\.ppt$',$original_file)) { $attachment = true; }
+if (eregi('\.xls$',$original_file)) { $attachment = true; }
+if (eregi('\.pdf$',$original_file)) { $attachment = true; }
+// Misc
if (eregi('\.sql$',$original_file)) { $attachment = true; }
if (eregi('\.html$',$original_file)) { $attachment = false; }
+// Text files
if (eregi('\.csv$',$original_file)) { $attachment = true; }
if (eregi('\.tsv$',$original_file)) { $attachment = true; }
-if (eregi('\.pdf$',$original_file)) { $attachment = true; }
-if (eregi('\.xls$',$original_file)) { $attachment = true; }
+// Images
if (eregi('\.jpg$',$original_file)) { $attachment = true; }
if (eregi('\.png$',$original_file)) { $attachment = true; }
if (eregi('\.tiff$',$original_file)) { $attachment = true; }
+// Calendar
if (eregi('\.vcs$',$original_file)) { $attachment = true; }
if (eregi('\.ics$',$original_file)) { $attachment = true; }
if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
@@ -364,7 +371,7 @@ if ($modulepart)
$sqlprotectagainstexternals = '';
}
- // Wrapping pour les exports
+ // Wrapping for export module
if ($modulepart == 'export')
{
// Aucun test necessaire car on force le rep de doanwload sur
@@ -374,6 +381,16 @@ if ($modulepart)
$sqlprotectagainstexternals = '';
}
+ // Wrapping for import module
+ if ($modulepart == 'import')
+ {
+ // Aucun test necessaire car on force le rep de doanwload sur
+ // le rep export qui est propre a l'utilisateur
+ $accessallowed=1;
+ $original_file=$conf->import->dir_temp.'/'.$original_file;
+ $sqlprotectagainstexternals = '';
+ }
+
// Wrapping pour l'editeur wysiwyg
if ($modulepart == 'editor')
{
diff --git a/htdocs/html.formfile.class.php b/htdocs/html.formfile.class.php
index 26e90556738..2d92f9bf761 100644
--- a/htdocs/html.formfile.class.php
+++ b/htdocs/html.formfile.class.php
@@ -376,7 +376,7 @@ class FormFile
print '';
if (!$iconPDF) print '';
// Affiche taille fichier
- if (!$iconPDF) print '
'.filesize($filedir."/".$file["name"]). ' bytes ';
+ if (!$iconPDF) print ''.dol_filesize($filedir."/".$file["name"]).' ';
// Affiche date fichier
if (!$iconPDF) print ''.dol_print_date(filemtime($filedir."/".$file["name"]),'dayhour').' ';
@@ -489,4 +489,16 @@ class FormFile
}
+/**
+ * Return size of a file with units
+ *
+ * @param $pathoffile
+ * @return string File size with units translated
+ */
+function dol_filesize($pathoffile)
+{
+ global $langs;
+ return filesize($pathoffile). ' '.$langs->trans("Bytes");
+}
+
?>
diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index b978fe3259d..9e939413c0f 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -375,7 +375,7 @@ if ($step == 2 && $datatoimport)
$var=true;
// Add help informations
- print '';
+ print ' ';
print $langs->trans("FileMustHaveOneOfFollowingFormat");
print ' ';
$liste=$objmodelimport->liste_modeles($db);
@@ -384,20 +384,20 @@ if ($step == 2 && $datatoimport)
$var=!$var;
print '';
print ''.img_picto_common($key,$objmodelimport->getPicto($key)).' ';
- print ''.$objmodelimport->getDriverLabel($key).' ';
+ print ''.$objmodelimport->getDriverLabel($key).' ';
//print ''.$objmodelimport->getLibLabel($key).' '.$objmodelimport->getLibVersion($key).' ';
print ' ';
}
- print ' ';
+ print ' ';
- print ''.$langs->trans("ChooseFileToImport").' ';
+ print ''.$langs->trans("ChooseFileToImport").' ';
- print ''.$langs->trans("FileWithDataToImport").' ';
+ print ''.$langs->trans("FileWithDataToImport").' ';
// Input file name box
$var=false;
- print '';
+ print ' ';
print ' ';
print ' ';
print ' ';
@@ -436,12 +436,25 @@ if ($step == 2 && $datatoimport)
{
if (eregi('^\.',$file)) continue;
+ $modulepart='import';
+ $urlsource=$_SERVER["PHP_SELF"].'?step='.$step.'&datatoimport='.$datatoimport;
+ $relativepath=$file;
$var=!$var;
print ' ';
print ''.img_mime($file).' ';
print ''.$file.' ';
- print 'del ';
- print 'next ';
+ // Affiche taille fichier
+ print ''.dol_filesize($dir.'/'.$file).' ';
+ // Affiche date fichier
+ print ''.dol_print_date(filemtime($dir.'/'.$file),'dayhour').' ';
+ // Del button
+ print ''.img_delete().' ';
+ // Action button
+ print '';
+ print ''.img_picto($langs->trans("NewImport"),'filenew').' ';
+ print ' ';
print ' ';
}
//print '';
@@ -499,57 +512,24 @@ if ($step == 3 && $datatoimport)
print '';
// Nbre champs importes
- print ''.$langs->trans("ImportedFields").' ';
- $list='';
- foreach($array_selected as $code=>$value)
- {
- $list.=($list?',':'');
- $list.=$langs->trans($objimport->array_import_fields[0][$code]);
- }
- print ''.$list.' ';
+ print ''.$langs->trans("FileToImport").' ';
+ print ''.$_GET["filetoimport"].' ';
print '';
print ' ';
- print $langs->trans("ChooseFieldsOrdersAndTitle").' ';
+ print $langs->trans("SelectImportFields");
print '';
print '';
+ print ''.$langs->trans("FieldsTitle").' ';
+ print ' ';
print ''.$langs->trans("Entities").' ';
print ''.$langs->trans("ImportedFields").' ';
print ''.$langs->trans("Position").' ';
- print ' ';
- print ''.$langs->trans("FieldsTitle").' ';
print ' ';
- // List deroulante des modeles d'import
- /* print '';
-
-
- print '';
- print '';
- print ''.$langs->trans("Entities").' ';
- print ''.$langs->trans("ImportableFields").' ';
- print '';
- print ''.$langs->trans("All")." ";
- print '/';
- print ''.$langs->trans("None")." ";
- print ' ';
- print ''.$langs->trans("ImportedFields").' ';
- print ' ';
-
// Champs importables
$fieldsarray=$objimport->array_import_fields[0];
@@ -598,7 +578,6 @@ if ($step == 3 && $datatoimport)
}
print '
';
- */
$var=true;
diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang
index 260668f3202..3c291158552 100644
--- a/htdocs/langs/en_US/exports.lang
+++ b/htdocs/langs/en_US/exports.lang
@@ -54,5 +54,6 @@ LineTotalTTC=Amount with tax for line
LineTotalVAT=Amount of VAT for line
TypeOfLineServiceOrProduct=Type of line (0=product, 1=service)
FileWithDataToImport=File with data to import
+FileToImport=File to import
FileMustHaveOneOfFollowingFormat=File to import must have one of following format
ChooseFileToImport=Choose file to import...
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/exports.lang b/htdocs/langs/fr_FR/exports.lang
index 2de71a76850..24bc19c187f 100644
--- a/htdocs/langs/fr_FR/exports.lang
+++ b/htdocs/langs/fr_FR/exports.lang
@@ -54,5 +54,6 @@ LineTotalTTC=Montant TTC de la ligne
LineTotalVAT=Montant TVA de la ligne
TypeOfLineServiceOrProduct=Type de ligne (0=produit, 1=service)
FileWithDataToImport=Fichier contenant les données à importer
+FileToImport=Fichier à importer
FileMustHaveOneOfFollowingFormat=Le fichier à importer doit avoir un des formats suivants
ChooseFileToImport=Choisissez le fichier à importer...
\ No newline at end of file