diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 6225c0cc501..edee1e5cba3 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -383,7 +383,8 @@ function dol_count_nb_of_line($file)
while (!feof($fp))
{
$line=fgets($fp);
- $nb++;
+ // We increase count only if read was success. We need test because feof return true only after fgets so we do n+1 fgets for a file with n lines.
+ if (! $line === false) $nb++;
}
fclose($fp);
}
diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php
index f35c565d071..d45f183faa2 100644
--- a/htdocs/core/modules/import/import_csv.modules.php
+++ b/htdocs/core/modules/import/import_csv.modules.php
@@ -452,17 +452,19 @@ class ImportCsv extends ModeleImports
}
// Loop on each hidden fields
- foreach($objimport->array_import_fieldshidden[0] as $key => $val)
+ if (is_array($objimport->array_import_fieldshidden[0]))
{
- if (! preg_match('/^'.preg_quote($alias).'\./', $key)) continue; // Not a field of current table
- if ($listfields) { $listfields.=', '; $listvalues.=', '; }
- if ($val == 'user->id')
- {
- $listfields.=preg_replace('/^'.preg_quote($alias).'\./','',$key);
- $listvalues.=$user->id;
- }
+ foreach($objimport->array_import_fieldshidden[0] as $key => $val)
+ {
+ if (! preg_match('/^'.preg_quote($alias).'\./', $key)) continue; // Not a field of current table
+ if ($listfields) { $listfields.=', '; $listvalues.=', '; }
+ if ($val == 'user->id')
+ {
+ $listfields.=preg_replace('/^'.preg_quote($alias).'\./','',$key);
+ $listvalues.=$user->id;
+ }
+ }
}
-
//print 'Show listfields='.$listfields.'
listvalues='.$listvalues.'
';
if (! $errorforthistable)
diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php
index 34af1fc11a7..bf8eacb2c39 100644
--- a/htdocs/core/modules/modProduct.class.php
+++ b/htdocs/core/modules/modProduct.class.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2010 Laurent Destailleur
+ * Copyright (C) 2004-2012 Laurent Destailleur
* Copyright (C) 2004 Sebastien Di Cintio
* Copyright (C) 2004 Benoit Mortier
* Copyright (C) 2005-2009 Regis Houssin
@@ -21,10 +21,13 @@
/**
* \defgroup produit Module products
- * \brief Module pour gerer le suivi de produits predefinis
+ * \brief Module to manage catalog of predefined products
+ */
+
+/**
* \file htdocs/core/modules/modProduct.class.php
* \ingroup produit
- * \brief Fichier de description et activation du module Produit
+ * \brief File to describe module to manage catalog of predefined products
*/
include_once(DOL_DOCUMENT_ROOT ."/core/modules/DolibarrModules.class.php");
@@ -154,7 +157,7 @@ class modProduct extends DolibarrModules
$this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r]=array('p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.note'=>"Note",'p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.duration'=>"Duration",'p.weight'=>"Weight",'p.volume'=>"Volume",'p.datec'=>'DateCreation*');
$this->import_entities_array[$r]=array(); // We define here only fields that use another picto
- $this->import_regex_array[$r]=array('p.ref'=>'[^ ]','p.tosell'=>'^[0|1]','p.tobuy'=>'^[0|1]','p.fk_product_type'=>'^[0|1]','p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
+ $this->import_regex_array[$r]=array('p.ref'=>'[^ ]','p.tosell'=>'^[0|1]$','p.tobuy'=>'^[0|1]$','p.fk_product_type'=>'^[0|1]$','p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_examplevalues_array[$r]=array('p.ref'=>"PR123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31');
}