diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php
index aaf62c657ce5d832c1830d896ee6e5c1ad59aa1f..aecf23dbf7b05425692a619ee29a708d4b79c479 100644
--- a/htdocs/adherents/document.php
+++ b/htdocs/adherents/document.php
@@ -134,7 +134,7 @@ if ($id > 0)
 
 
 		// Construit liste des fichiers
-		$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3);
+		$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
 		$totalsize=0;
 		foreach($filearray as $key => $file)
 		{
diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php
index 80e976644a45c937fd995422464f6e198f29977b..1712878ea32853996cf58c8af3a36dd9c1fb98b6 100755
--- a/htdocs/comm/action/document.php
+++ b/htdocs/comm/action/document.php
@@ -201,7 +201,7 @@ if ($objectid > 0)
 		print '</table><br><table class="border" width="100%">';
 
 		// Construit liste des fichiers
-		$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3);
+		$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
 		$totalsize=0;
 		foreach($filearray as $key => $file)
 		{
diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php
index 25bd527d84120d08ab83e734bf8536d04fa94d06..c6de7a48bd2473b3f6681ecb56d325fbf3e27b7b 100644
--- a/htdocs/comm/propal/document.php
+++ b/htdocs/comm/propal/document.php
@@ -143,7 +143,7 @@ if ($id > 0 || ! empty($ref))
 
 
 		// Construit liste des fichiers
-		$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3);
+		$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
 		$totalsize=0;
 		foreach($filearray as $key => $file)
 		{
diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php
index 1db72e2fff4fb07b4a9a0635361be05a3b2a8a10..fbcbeab04cfe7c2371d4f43ffb287ad2fe0a6c18 100644
--- a/htdocs/commande/document.php
+++ b/htdocs/commande/document.php
@@ -135,7 +135,7 @@ if ($id > 0 || ! empty($ref))
 
 
 	// Construit liste des fichiers
-	$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3);
+	$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
 	$totalsize=0;
 	foreach($filearray as $key => $file)
 	{
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index f7716c40b8bcdecd2b1804a8cf6fbc333f2ad1a4..6c0ccede91640bbfa74d2472d7550e6485104c62 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -145,7 +145,7 @@ if ($id > 0 || ! empty($ref))
 
 
 		// Construit liste des fichiers
-		$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3);
+		$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
 		$totalsize=0;
 		foreach($filearray as $key => $file)
 		{
diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php
index cb475acad1523090fa2db46f61dd17b4862ea15e..d8af6d6626100e457b0cee974ab86589ee347a02 100644
--- a/htdocs/contrat/document.php
+++ b/htdocs/contrat/document.php
@@ -132,7 +132,7 @@ if ($contrat->id)
 
 
 	// Construit liste des fichiers
-	$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3);
+	$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
 	$totalsize=0;
 	foreach($filearray as $key => $file)
 	{
diff --git a/htdocs/ecm/docmine.php b/htdocs/ecm/docmine.php
index 6736c9548105b70f1bdcf17dda4d7ff64c0198d9..ab10615445c1848a999e8b2272783061067fd620 100644
--- a/htdocs/ecm/docmine.php
+++ b/htdocs/ecm/docmine.php
@@ -212,7 +212,7 @@ $form=new Form($db);
 
 
 // Construit liste des fichiers
-$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3);
+$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
 $totalsize=0;
 foreach($filearray as $key => $file)
 {
diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php
index 2ce6bbdf10d77ed13d489187d66cd8a8a3a48475..b4a4b8052c25bc43f1c57431bd8c1a0f4f27ef1f 100644
--- a/htdocs/fichinter/document.php
+++ b/htdocs/fichinter/document.php
@@ -131,7 +131,7 @@ if ($object->id)
 
 
 	// Construit liste des fichiers
-	$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3);
+	$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
 	$totalsize=0;
 	foreach($filearray as $key => $file)
 	{
diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php
index 6894dc827601af138fde75cf42ffe55051518bd3..b335242599076787b6fddc2a08b3b68efba391a5 100644
--- a/htdocs/fourn/commande/document.php
+++ b/htdocs/fourn/commande/document.php
@@ -142,7 +142,7 @@ if ($id > 0 || ! empty($ref))
 
 
 	// Construit liste des fichiers
-	$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3);
+	$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
 	$totalsize=0;
 	foreach($filearray as $key => $file)
 	{
diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php
index 53a2ce32755c4341c212ade024d0bbdd1215f1bd..593ee479db13ec0f1affb707dbe372671eaa449e 100644
--- a/htdocs/fourn/facture/document.php
+++ b/htdocs/fourn/facture/document.php
@@ -137,7 +137,7 @@ if ($facid > 0)
 
 
 		// Construit liste des fichiers
-		$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3);
+		$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
 		$totalsize=0;
 		foreach($filearray as $key => $file)
 		{
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index 38aac4c135ba7611811eed7f543ea98122e35a41..28ac240e83de7fe93c47337e3977250c07cf6597 100755
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -135,7 +135,7 @@ if ($product->id)
 
 
 	// Construit liste des fichiers
-	$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3);
+	$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
 	$totalsize=0;
 	foreach($filearray as $key => $file)
 	{
diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php
index 93d573669629fad3b0758908aaf3c8a844d467a8..9c51c12828d14bbad187d21ff4b0e729d3646d82 100644
--- a/htdocs/projet/document.php
+++ b/htdocs/projet/document.php
@@ -135,7 +135,7 @@ if ($id > 0 || ! empty($ref))
 	dol_fiche_head($head, 'document', $langs->trans("Project"), 0, ($project->public?'projectpub':'project'));
 
 	// Files list constructor
-	$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3);
+	$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
 	$totalsize=0;
 	foreach($filearray as $key => $file)
 	{
diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php
index 71a040aa46d2c7af58b0268c827e6ccc1025c234..e597529d2acaaec5df80fea15a1e35b300420fc4 100644
--- a/htdocs/projet/tasks/document.php
+++ b/htdocs/projet/tasks/document.php
@@ -145,7 +145,7 @@ if ($id > 0 || ! empty($ref))
 	dol_fiche_head($head, 'document', $langs->trans("Task"), 0, 'projecttask');
 
 	// Files list constructor
-	$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3);
+	$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
 	$totalsize=0;
 	foreach($filearray as $key => $file)
 	{
diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php
index 6ef3aa61869cfda87aa645084aa9ebe2f5efef0e..edf4c5b21b809430167f40d83c86c458a891855a 100644
--- a/htdocs/societe/document.php
+++ b/htdocs/societe/document.php
@@ -130,7 +130,7 @@ if ($socid > 0)
 
 
 		// Construit liste des fichiers
-		$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3);
+		$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
 		$totalsize=0;
 		foreach($filearray as $key => $file)
 		{
@@ -143,7 +143,7 @@ if ($socid > 0)
 		// Ref
 		print '<tr><td width="30%">'.$langs->trans("Name").'</td>';
 		print '<td colspan="3">';
-		print $form->showrefnav($societe,'socid','',1,'rowid','nom');
+		print $form->showrefnav($societe,'socid','',($user->societe_id?0:1),'rowid','nom');
 		print '</td></tr>';
 
 		// Prefix