diff --git a/htdocs/html.formfile.class.php b/htdocs/html.formfile.class.php
index d1f89a7ddde..26e90556738 100644
--- a/htdocs/html.formfile.class.php
+++ b/htdocs/html.formfile.class.php
@@ -123,7 +123,7 @@ class FormFile
/**
* \brief Affiche la cartouche de la liste des documents d'une propale, facture...
* \param modulepart propal=propal, facture=facture, ...
- * \param filename Sub dir to scan (vide si filedir deja complet)
+ * \param filename Sub dir to scan (use '' if filedir already complete)
* \param filedir Dir to scan
* \param urlsource Url of origin page (for return)
* \param genallowed Generation is allowed (1/0 or array of formats)
@@ -137,8 +137,6 @@ class FormFile
* \param param More param on http links
* \param title Title to show on top of form
* \param buttonlabel Label on submit button
- * \remarks Le fichier de facture detaillee est de la forme
- * REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse
* \return int <0 si ko, nbre de fichiers affiches si ok
*/
function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='')
diff --git a/htdocs/imports/import.class.php b/htdocs/imports/import.class.php
index 95beadcdd2c..f80474ad988 100644
--- a/htdocs/imports/import.class.php
+++ b/htdocs/imports/import.class.php
@@ -54,7 +54,6 @@ class Import
foreach($conf->file->dol_document_root as $dirroot)
{
$dir = $dirroot.'/includes/modules';
- $handle=opendir($dir);
// Search available exports
$handle=@opendir($dir);
diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index 8866a407b79..b978fe3259d 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -364,16 +364,18 @@ if ($step == 2 && $datatoimport)
- print '
';
if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
- $imp = new DolibarrImport($db);
- print "eee".$conf->import->dir_temp;
- create_ext_dir($conf->import->dir_temp);
- if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $imp->upload_dir . "/" . $_FILES['userfile']['name'],1) > 0)
+ create_exdir($conf->import->dir_temp);
+ $nowyearmonth=dol_date('YmdHis',dol_now(),0);
+
+ $fullpath=$conf->import->dir_temp . "/" . $nowyearmonth . '-'.$_FILES['userfile']['name'];
+ if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $fullpath,1) > 0)
{
-
- $imp->ImportClients($imp->upload_dir . "/" . $_FILES['userfile']['name']);
-
- print "Imports : ".$imp->nb_import."
";
- print "Imports corrects : ".$imp->nb_import_ok."
";
- print "Imports erreurs : ".$imp->nb_import_ko."
";
-
+ dol_syslog("File ".$fullpath." was added for import");
}
else
{
- $mesg = "Files was not read";
+ $langs->load("errors");
+ $mesg = $langs->trans("ErrorFailedToSaveFile");
}
}
+ $dir = $conf->import->dir_temp;
+
+ // Search available imports
+ $handle=@opendir($dir);
+ if ($handle)
+ {
+ //print '';
+ //print '';
+
+ // Search available files to import
+ $i=0;
+ while (($file = readdir($handle))!==false)
+ {
+ if (eregi('^\.',$file)) continue;
+
+ $var=!$var;
+ print '';
+ print '| '.img_mime($file).' | ';
+ print ''.$file.' | ';
+ print 'del | ';
+ print 'next | ';
+ print ' ';
+ }
+ //print ' |
';
+ }
+
+ print '';
+
+
+ print '';
+
+ if ($mesg) print $mesg;
+
+}
+
+if ($step == 3 && $datatoimport)
+{
+ asort($array_selected);
+
+ llxHeader('',$langs->trans("NewImport"));
+
+ /*
+ * Affichage onglets
+ */
+ $h = 0;
+
+ $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=1';
+ $head[$h][1] = $langs->trans("Step")." 1";
+ $h++;
+
+ $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=2&datatoimport='.$datatoimport;
+ $head[$h][1] = $langs->trans("Step")." 2";
+ $h++;
+
+ $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=3&datatoimport='.$datatoimport;
+ $head[$h][1] = $langs->trans("Step")." 3";
+ $hselected=$h;
+ $h++;
+
+ dol_fiche_head($head, $hselected, $langs->trans("NewImport"));
+
+ print '';
+
+ // Module
+ print '| '.$langs->trans("Module").' | ';
+ print '';
+ //print img_object($objimport->array_import_module[0]->getName(),$objimport->array_import_module[0]->picto).' ';
+ print $objimport->array_import_module[0]->getName();
+ print ' |
';
+
+ // Lot de donnees a importer
+ print '| '.$langs->trans("DatasetToImport").' | ';
+ print '';
+ print img_object($objimport->array_import_module[0]->getName(),$objimport->array_import_icon[0]).' ';
+ print $objimport->array_import_label[0];
+ 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 '
';
+ print '
';
+
+ print $langs->trans("ChooseFieldsOrdersAndTitle").'
';
+
+ print '';
+ 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 '';
-
- if ($mesg) print $mesg;
-
- /*
- * Barre d'action
- *
- */
- print '';
-
-}
-
-if ($step == 3 && $datatoimport)
-{
- asort($array_selected);
-
- llxHeader('',$langs->trans("NewImport"));
-
- /*
- * Affichage onglets
- */
- $h = 0;
-
- $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=1';
- $head[$h][1] = $langs->trans("Step")." 1";
- $h++;
-
- $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=2&datatoimport='.$datatoimport;
- $head[$h][1] = $langs->trans("Step")." 2";
- $h++;
-
- $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=3&datatoimport='.$datatoimport;
- $head[$h][1] = $langs->trans("Step")." 3";
- $hselected=$h;
- $h++;
-
- dol_fiche_head($head, $hselected, $langs->trans("NewImport"));
-
- print '';
-
- // Module
- print '| '.$langs->trans("Module").' | ';
- print '';
- //print img_object($objimport->array_import_module[0]->getName(),$objimport->array_import_module[0]->picto).' ';
- print $objimport->array_import_module[0]->getName();
- print ' |
';
-
- // Lot de donn�es � importer
- print '| '.$langs->trans("DatasetToImport").' | ';
- print '';
- print img_object($objimport->array_import_module[0]->getName(),$objimport->array_import_icon[0]).' ';
- print $objimport->array_import_label[0];
- print ' |
';
-
- // Nbre champs import�s
- 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 '
';
- print '
';
-
- print $langs->trans("ChooseFieldsOrdersAndTitle").'
';
-
- print '';
- print '';
- print '| '.$langs->trans("Entities").' | ';
- print ''.$langs->trans("ImportedFields").' | ';
- print ''.$langs->trans("Position").' | ';
- print ' | ';
- print ''.$langs->trans("FieldsTitle").' | ';
- print '
';
$var=true;
foreach($array_selected as $code=>$value)
diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang
index 386c72878d5..260668f3202 100644
--- a/htdocs/langs/en_US/exports.lang
+++ b/htdocs/langs/en_US/exports.lang
@@ -55,3 +55,4 @@ LineTotalVAT=Amount of VAT for line
TypeOfLineServiceOrProduct=Type of line (0=product, 1=service)
FileWithDataToImport=File with data 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/en_US/main.lang b/htdocs/langs/en_US/main.lang
index fd7e5a95bf9..a6d7b6b4b30 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -506,6 +506,8 @@ Informations=Informations
Page=Page
Notes=Notes
AddNewLine=Add new line
+AddFile=Add file
+ListOfFiles=List of available files
FreeZone=Free text
CloneMainAttributes=Clone object with its main attributes
PDFMerge=PDF Merge
diff --git a/htdocs/langs/fr_FR/exports.lang b/htdocs/langs/fr_FR/exports.lang
index f9c73cf8e30..2de71a76850 100644
--- a/htdocs/langs/fr_FR/exports.lang
+++ b/htdocs/langs/fr_FR/exports.lang
@@ -54,4 +54,5 @@ 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
-FileMustHaveOneOfFollowingFormat=Le fichier à importer doit avoir un des formats suivants
\ No newline at end of file
+FileMustHaveOneOfFollowingFormat=Le fichier à importer doit avoir un des formats suivants
+ChooseFileToImport=Choisissez le fichier à importer...
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang
index 37700ddb041..86e3316a8ec 100644
--- a/htdocs/langs/fr_FR/main.lang
+++ b/htdocs/langs/fr_FR/main.lang
@@ -506,6 +506,8 @@ Informations=Informations
Page=Page
Notes=Notes
AddNewLine=Ajout nouvelle ligne
+AddFile=Ajouter fichier
+ListOfFiles=Liste des fichiers disponibles
FreeZone=Zone libre
CloneMainAttributes=Cloner l'objet avec ces attributs principaux
PDFMerge=Fusion PDF
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index 9a776293925..ed2df4d007c 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -37,7 +37,9 @@ if (! defined('ADODB_DATE_VERSION')) include_once(DOL_DOCUMENT_ROOT."/includes/a
/**
* \brief Return date for now
- * \param mode 'gmt' => we return GMT timestamp, 'tzref' => we use the company timezone
+ * \param mode 'gmt' => we return GMT timestamp,
+ * 'tzref' => we use the company timezone
+ * 'tzuser' => we use the user timezone
* \return date Timestamp
*/
function dol_now($mode='tzref')
@@ -48,6 +50,11 @@ function dol_now($mode='tzref')
// TODO Should use the timezone of the company instead of timezone of server
$ret=mktime();
}
+ else if ($mode == 'tzuser')
+ {
+ // TODO Should use the timezone of the user instead of timezone of server
+ $ret=mktime();
+ }
return $ret;
}
@@ -559,6 +566,7 @@ function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=0,$check=1)
* @param gm 1=Input informations are GMT values, otherwise local to user
* @param check 0=No check on parameters (Can use day 32, etc...)
* @return timestamp Date en timestamp, '' if error
+ * @see dol_date
*/
function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=0,$check=1)
{
@@ -614,9 +622,10 @@ function dolibarr_date($fmt, $timestamp, $gm=0)
/**
* \brief Returns formated date
* \param fmt Format (Exemple: 'Y-m-d H:i:s')
- * \param timestamp Date. Exemple: Si timestamp=0 et gm=1, renvoi 01/01/1970 00:00:00
+ * \param timestamp Date. Example: If timestamp=0 and gm=1, return 01/01/1970 00:00:00
* \param gm 1 if timestamp was built with gmmktime, 0 if timestamp was build with mktime
* \return string Formated date
+ * \see dol_mktime
*/
function dol_date($fmt, $timestamp, $gm=0)
{