diff --git a/ChangeLog b/ChangeLog
index 9631016c06d32449459d86f499973d7d694a08dd..29dc1eaf4a2f954216623700ac0175582dfe233b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -155,6 +155,7 @@ Fix: [ bug #1484 ] BILL_SUPPLIER_PAYED trigger action does not intercept failure
 Fix: [ bug #1482 ] Several supplier invoice triggers do not show trigger error messages
 Fix: [ bug #1486 ] LINEBILL_SUPPLIER_CREATE and LINEBILL_SUPPLIER_UPDATE triggers do not intercept trigger action
 Fix: [ bug #1522 ] Element list into associate object into project are no more filterd by project thirdparty
+Fix: [ bug #1526 ] Thumbs of files uploaded with dots in their names do not load correctly
 Fix: Import ProfId1 to siren and ProfId2 to siret
 
 ***** ChangeLog for 3.5.3 compared to 3.5.2 *****
diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec
index ffd60227596b4f857389abf48c2c368277b254b7..6aaa712f644ead5b97a4c92f34c564ce36dc1718 100755
--- a/build/rpm/dolibarr_fedora.spec
+++ b/build/rpm/dolibarr_fedora.spec
@@ -333,10 +333,10 @@ fi
 
 # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
 %changelog
-* Wed Jun 20 2014 Laurent Destailleur 3.5.4-0.3
+* Wed Jul 2 2014 Laurent Destailleur 3.6.0-0.2.b
 - Upstream release
 
-* Fri May 9 2014 Laurent Destailleur 3.6.0-0.2.b
+* Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3
 - Upstream release
 
 * Fri May 2 2014 Laurent Destailleur 3.5.3-0.3
diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec
index 0a99f8180ac827c48ca78bcc2b698f077cef4fea..7c8304cd56b863d9f88804cfafb62ac26dc870b0 100755
--- a/build/rpm/dolibarr_generic.spec
+++ b/build/rpm/dolibarr_generic.spec
@@ -569,10 +569,10 @@ fi
 
 # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
 %changelog
-* Wed Jun 20 2014 Laurent Destailleur 3.5.4-0.3
+* Wed Jul 2 2014 Laurent Destailleur 3.6.0-0.2.b
 - Upstream release
 
-* Fri May 9 2014 Laurent Destailleur 3.6.0-0.2.b
+* Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3
 - Upstream release
 
 * Fri May 2 2014 Laurent Destailleur 3.5.3-0.3
diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec
index 3242d59a3dac8f5692ce23e5a819459335e45812..707371aed15bfe86a27cfa871bf46b0c18cba8de 100755
--- a/build/rpm/dolibarr_mandriva.spec
+++ b/build/rpm/dolibarr_mandriva.spec
@@ -338,10 +338,10 @@ fi
 
 # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
 %changelog
-* Wed Jun 20 2014 Laurent Destailleur 3.5.4-0.3
+* Wed Jul 2 2014 Laurent Destailleur 3.6.0-0.2.b
 - Upstream release
 
-* Fri May 9 2014 Laurent Destailleur 3.6.0-0.2.b
+* Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3
 - Upstream release
 
 * Fri May 2 2014 Laurent Destailleur 3.5.3-0.3
diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec
index 2781f9b8dbfe49c418374a9fa7add068f8dee91c..417756b486f142eb57fb0c38e9b7094ffc700981 100755
--- a/build/rpm/dolibarr_opensuse.spec
+++ b/build/rpm/dolibarr_opensuse.spec
@@ -349,10 +349,10 @@ fi
 
 # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
 %changelog
-* Wed Jun 20 2014 Laurent Destailleur 3.5.4-0.3
+* Wed Jul 2 2014 Laurent Destailleur 3.6.0-0.2.b
 - Upstream release
 
-* Fri May 9 2014 Laurent Destailleur 3.6.0-0.2.b
+* Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3
 - Upstream release
 
 * Fri May 2 2014 Laurent Destailleur 3.5.3-0.3
diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php
index 0036aa430f178d4a5aa75ec4c9aca0fda3070fcc..bdb96718dfad6c9552885ef9adcffc8df6a27c0a 100644
--- a/htdocs/commande/orderstoinvoice.php
+++ b/htdocs/commande/orderstoinvoice.php
@@ -285,7 +285,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
 												'HT',
 												0,
 												$product_type,
-												$lines[$i]->rang,
+												$ii,
 												$lines[$i]->special_code,
 												$object->origin,
 												$lines[$i]->rowid,
diff --git a/htdocs/core/class/cookie.class.php b/htdocs/core/class/cookie.class.php
index 0797be330bf775a757d7b461ec849a1eb0170b05..bcca9fcfa73c2402fd79412eec9f1fb31707947a 100644
--- a/htdocs/core/class/cookie.class.php
+++ b/htdocs/core/class/cookie.class.php
@@ -91,7 +91,9 @@ class DolCookie
 			$num = (count($this->cookiearray) - 2);
 			for ($f = 0; $f <= $num; $f++)
 			{
-				$this->myValue .= strval(chr($this->cookiearray[$f]/$this->myKey));
+				if (!empty($this->myKey)) {
+					$this->myValue .= strval(chr($this->cookiearray[$f]/$this->myKey));
+				}
 			}
 
 			return(base64_decode($this->myValue));
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index dc4a74cb5256e1b7013b1686f9eb8a639024cfdc..6e764941d314e09a3df31c5b4a2c7baae9a60b16 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -4,6 +4,7 @@
  * Copyright (c) 2010      Juanjo Menent		<jmenent@2byte.es>
  * Copyright (c) 2013      Charles-Fr BENKE		<charles.fr@benke.fr>
  * Copyright (C) 2013      Cédric Salvador      <csalvador@gpcsolutions.fr>
+ * Copyright (c) 2014       Marcos García       <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -801,10 +802,9 @@ class FormFile
 					// Preview
 					if (empty($useinecm))
 					{
+						$fileinfo = pathinfo($file['name']);
 						print '<td align="center">';
-						$tmp=explode('.',$file['name']);
-						if (count($tmp) == 3) $minifile=$tmp[0].'_mini.'.$tmp[1].'.'.strtolower($tmp[2]);	// Thumbs are created with filename in lower case
-						else $minifile=$tmp[0].'_mini.'.strtolower($tmp[1]);	// Thumbs are created with filename in lower case
+						$minifile=$fileinfo['filename'].'_mini.'.strtolower($fileinfo['extension']);	// Thumbs are created with filename in lower case
 						if (image_format_supported($file['name']) > 0) print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.'thumbs/'.$minifile).'" title="">';
 						else print '&nbsp;';
 						print '</td>';
diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php
index 3d493b6571d0abd1d51b6b17e0697fd5a6d76d51..8d479e89e4416d75ab493278a00c1a722371b852 100644
--- a/htdocs/core/class/html.formprojet.class.php
+++ b/htdocs/core/class/html.formprojet.class.php
@@ -165,9 +165,10 @@ class FormProjets
 	 *    Build Select List of element associable to a project
 	 *
 	 *    @param	string	$table_element		Table of the element to update
+	 *    @param	int		$socid				socid to filter
 	 *    @return	string						The HTML select list of element
 	 */
-	function select_element($table_element)
+	function select_element($table_element,$socid=0)
 	{
 		global $conf;
 
@@ -194,8 +195,8 @@ class FormProjets
 
 		$sql.= " FROM ".MAIN_DB_PREFIX.$table_element;
 		$sql.= " WHERE ".$projectkey." is null";
-		if (!empty($this->societe->id)) {
-			$sql.= " AND fk_soc=".$this->societe->id;
+		if (!empty($socid)) {
+			$sql.= " AND fk_soc=".$socid;
 		}
 		$sql.= ' AND entity='.getEntity('project');
 		$sql.= " ORDER BY ref DESC";
@@ -229,4 +230,4 @@ class FormProjets
 	}
 
 
-}
\ No newline at end of file
+}
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index 6edaec7b35ab5c5951cdaa836974cf4c537de3d9..9d09c7c25c6896b5adf7cc4b78f0e44867b89153 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -229,13 +229,11 @@ foreach ($listofreferent as $key => $value)
 
 		print_titre($langs->trans($title));
 		
-		$selectList=$formproject->select_element($tablename);
-		if ($selectList<0) {
+		$selectList=$formproject->select_element($tablename,$project->societe->id);
+
+		if (!$selectList || ($selectList<0)) {
 			setEventMessage($formproject->error,'errors');
-		}
-		
-		if ($selectList)
-		{
+		} else {
 			print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$projectid.'" method="post">';
 			print '<input type="hidden" name="tablename" value="'.$tablename.'">';
 			print '<input type="hidden" name="action" value="addelement">';