diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php
index 266ee77b7d91c95f3cf2a45eccc4e337fe11c586..04704ba2ff475b4dfded0b939e6bfe9a6fe0bfa4 100644
--- a/htdocs/comm/propal/document.php
+++ b/htdocs/comm/propal/document.php
@@ -130,21 +130,10 @@ if ($object->id > 0)
 
 	print '</div>';
 
-	/*
-	 * Confirmation suppression fichier
-	 */
-	if ($action == 'delete')
-	{
-		print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
-	}
-
-	// Affiche formulaire upload
-	$formfile=new FormFile($db);
-	$formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id,'',0,0,$user->rights->propal->creer,50,$object);
-
-
-	// List of document
-	$formfile->list_of_documents($filearray,$object,'propal');
+	$modulepart = 'propal';
+	$permission = $user->rights->propal->creer;
+	$param = '&id=' . $object->id;
+	include_once DOL_DOCUMENT_ROOT . '/core/tpl/doc2.tpl.php';
 }
 else
 {
diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php
index 32e666d1a7b7b25e4f162290c059baf953f34df6..9ba0827e7e13e1e27be679edc4f697b6599c76e1 100644
--- a/htdocs/commande/document.php
+++ b/htdocs/commande/document.php
@@ -119,23 +119,10 @@ if ($id > 0 || ! empty($ref))
 		print "</table>\n";
 		print "</div>\n";
 
-		/*
-		 * Confirmation suppression fichier
-		 */
-		if ($action == 'delete')
-		{
-			print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
-			
-		}
-
-		// Affiche formulaire upload
-		$formfile=new FormFile($db);
-		$formfile->form_attach_new_file(DOL_URL_ROOT.'/commande/document.php?id='.$object->id,'',0,0,$user->rights->commande->creer,50,$object);
-
-
-		// List of document
-		$param='&id='.$object->id;
-		$formfile->list_of_documents($filearray,$object,'commande',$param);
+		$modulepart = 'commande';
+		$permission = $user->rights->commande->creer;
+		$param = '&id=' . $object->id;
+		include_once DOL_DOCUMENT_ROOT . '/core/tpl/doc2.tpl.php';
 	}
 	else
 	{
diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php
index 93258ab229798d3cbe3615af774b182e01bd8a0a..0177891491d49540b4caaaa41329bdb01287000f 100644
--- a/htdocs/compta/deplacement/document.php
+++ b/htdocs/compta/deplacement/document.php
@@ -120,23 +120,10 @@ if ($object->id)
 
     print '</div>';
 
-    /*
-     * Confirmation suppression fichier
-     */
-    if ($action == 'delete')
-    {
-    	print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
-    	
-    }
-
-    // Affiche formulaire upload
-   	$formfile=new FormFile($db);
-	$formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/deplacement/document.php?id='.$object->id,'',0,0,$user->rights->deplacement->creer,50,$object);
-
-
-	// List of document
-	$param='&id='.$object->id;
-	$formfile->list_of_documents($filearray,$object,'deplacement',$param);
+    $modulepart = 'deplacement';
+    $permission = $user->rights->deplacement->creer;
+    $param = '&id=' . $object->id;
+    include_once DOL_DOCUMENT_ROOT . '/core/tpl/doc2.tpl.php';
 
 }
 else
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index 92292375ac4d5201220060f0acc3d63d33776deb..5bce75e363c6b401143d5dd5010522a7a2106aea 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -147,24 +147,10 @@ if ($id > 0 || ! empty($ref))
 		print "</table>\n";
 		print "</div>\n";
 
-    	/*
-		 * Confirmation suppression fichier
-		 */
-		if ($action == 'delete')
-		{
-			print $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
-			
-		}
-
-
-		// Affiche formulaire upload
-		$formfile=new FormFile($db);
-		$formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id,'',0,0,$user->rights->facture->creer,50,$object);
-
-
-		// List of document
-		$param='&facid='.$object->id;
-		$formfile->list_of_documents($filearray,$object,'facture',$param);
+		$modulepart = 'facture';
+		$permission = $user->rights->facture->creer;
+		$param = '&id=' . $object->id;
+		include_once DOL_DOCUMENT_ROOT . '/core/tpl/doc2.tpl.php';
 
 	}
 	else
diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php
index b63679cc1ded287dd47744cf30987813944fc79d..83d9870b0db21ffb00db5d008a7d047c48439c96 100644
--- a/htdocs/contrat/document.php
+++ b/htdocs/contrat/document.php
@@ -122,24 +122,10 @@ if ($object->id)
 
     print '</div>';
 
-    /*
-     * Confirmation suppression fichier
-     */
-    if ($action == 'delete')
-    {
-    	print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
-    	
-    }
-
-
-    // Affiche formulaire upload
-   	$formfile=new FormFile($db);
-	$formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id,'',0,0,$user->rights->contrat->creer,50,$object);
-
-
-	// List of document
-	$param='&id='.$object->id;
-	$formfile->list_of_documents($filearray,$object,'contract',$param);
+    $modulepart = 'contract';
+    $permission = $user->rights->contrat->creer;
+    $param = '&id=' . $object->id;
+    include_once DOL_DOCUMENT_ROOT . '/core/tpl/doc2.tpl.php';
 
 }
 else
diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php
index 2dc8f7aedeae35ec0e0c086974ccd0b61de6c916..1505facbab55483af68c5f7c9cdc5dbfc420c252 100644
--- a/htdocs/fichinter/document.php
+++ b/htdocs/fichinter/document.php
@@ -120,23 +120,10 @@ if ($object->id)
 
     print '</div>';
 
-    /*
-     * Confirmation suppression fichier
-     */
-    if ($action == 'delete')
-    {
-    	print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
-    	
-    }
-
-    // Affiche formulaire upload
-   	$formfile=new FormFile($db);
-	$formfile->form_attach_new_file(DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id,'',0,0,$user->rights->ficheinter->creer,50,$object);
-
-
-	// List of document
-	$param='&id='.$object->id;
-	$formfile->list_of_documents($filearray,$object,'ficheinter',$param);
+    $modulepart = 'ficheinter';
+    $permission = $user->rights->ficheinter->creer;
+    $param = '&id=' . $object->id;
+    include_once DOL_DOCUMENT_ROOT . '/core/tpl/doc2.tpl.php';
 
 }
 else
diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php
index 581fac2df66771e5a751cbcf7bddedf30943e87f..303e505c18b3d568f3cf9dc5e04bd8387775e3b5 100644
--- a/htdocs/fourn/commande/document.php
+++ b/htdocs/fourn/commande/document.php
@@ -158,23 +158,11 @@ if ($object->id > 0)
 
 	print "</div>\n";
 
-	/*
-	 * Confirmation suppression fichier
-	*/
-	if ($action == 'delete')
-	{
-		print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
-		
-	}
-
-	// Affiche formulaire upload
-	$formfile=new FormFile($db);
-	$formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/commande/document.php?id='.$object->id,'',0,0,$user->rights->fournisseur->commande->creer,50,$object);
-
+	$modulepart = 'commande_fournisseur';
+	$permission = $user->rights->fournisseur->commande->creer;
+	$param = '&id=' . $object->id;
+	include_once DOL_DOCUMENT_ROOT . '/core/tpl/doc2.tpl.php';
 
-	// List of document
-	$param='&id='.$object->id;
-	$formfile->list_of_documents($filearray,$object,'commande_fournisseur',$param);
 }
 else
 {
diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php
index 287708da21135f8846a15a4987fa81b845c3f0b4..7779b58d2206b1465c926edea643fbc761f08455 100644
--- a/htdocs/fourn/facture/document.php
+++ b/htdocs/fourn/facture/document.php
@@ -177,17 +177,10 @@ if ($object->id > 0)
 	print '</table>';
 	print '</div>';
 
-	
-	// Affiche formulaire upload
-	$formfile=new FormFile($db);
-	$formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?facid='.$object->id, '', 0, 0, $user->rights->fournisseur->facture->creer, 50, $object, '', 0, dol_sanitizeFileName($object->ref.'_'.$object->ref_supplier.'___file__'));
-
-
-	// List of document
-	$param='&facid='.$object->id;
-	$ref=dol_sanitizeFileName($object->ref);
-	$formfile->list_of_documents($filearray,$object,'facture_fournisseur',$param,0,get_exdir($object->id,2,0).$ref.'/');
-
+	$modulepart = 'facture_fournisseur';
+	$permission = $user->rights->fournisseur->facture->creer;
+	$param = '&facid=' . $object->id;
+	include_once DOL_DOCUMENT_ROOT . '/core/tpl/doc2.tpl.php';
 }
 else
 {
diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php
index 84c9f1e109cd31d08ccb2e049836360b29ebc8f8..7644ef5486c4fee381db2fdfefd48a023f4b98f7 100644
--- a/htdocs/projet/document.php
+++ b/htdocs/projet/document.php
@@ -104,11 +104,6 @@ if ($object->id > 0)
 		$totalsize+=$file['size'];
 	}
 
-	if ($action == 'delete')
-	{
-		print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&urlfile=".urlencode(GETPOST("urlfile")),$langs->trans("DeleteAFile"),$langs->trans("ConfirmDeleteAFile"),"confirm_delete",'','',1);
-	}
-
 	print '<table class="border" width="100%">';
 
 	$linkback = '<a href="'.DOL_URL_ROOT.'/projet/liste.php">'.$langs->trans("BackToList").'</a>';
@@ -149,14 +144,10 @@ if ($object->id > 0)
 	print "</table>\n";
 	print "</div>\n";
 
-	// Affiche formulaire upload
-	$formfile=new FormFile($db);
-	$formfile->form_attach_new_file(DOL_URL_ROOT.'/projet/document.php?id='.$object->id,'',0,0,($userWrite>0),50,$object);
-
-
-	// List of document
-	$param='&id='.$object->id;
-	$formfile->list_of_documents($filearray,$object,'projet',$param,0,'',($userWrite>0));
+	$modulepart = 'projet';
+	$permission = ($userWrite > 0);
+	$param = '&id=' . $object->id;
+	include_once DOL_DOCUMENT_ROOT . '/core/tpl/doc2.tpl.php';
 
 }
 else
diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php
index 0605592e4d70aba59e22a08bc3269c94b3d07c9c..e9b172cbc0a69d9e5168832ab9b291c585423f9f 100644
--- a/htdocs/societe/document.php
+++ b/htdocs/societe/document.php
@@ -152,7 +152,7 @@ if ($object->id)
 	$modulepart = 'societe';
 	$permission = $user->rights->societe->creer;
 	$param = '&id=' . $object->id;
-	include DOL_DOCUMENT_ROOT . '/core/tpl/doc2.tpl.php';
+	include_once DOL_DOCUMENT_ROOT . '/core/tpl/doc2.tpl.php';
 }
 else
 {