From d27dea832024ff8df77be9ef69ed649e2321cd8e Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Fri, 14 Oct 2016 18:09:24 +0200
Subject: [PATCH] NEW Can rename uploaded or generated files on all "documents"
 tabs.

---
 htdocs/adherents/document.php         | 1 +
 htdocs/comm/propal/document.php       | 1 +
 htdocs/commande/document.php          | 1 +
 htdocs/compta/bank/document.php       | 1 +
 htdocs/compta/facture/document.php    | 1 +
 htdocs/contact/document.php           | 1 +
 htdocs/contrat/document.php           | 1 +
 htdocs/don/document.php               | 1 +
 htdocs/fichinter/document.php         | 1 +
 htdocs/fourn/commande/document.php    | 1 +
 htdocs/fourn/facture/document.php     | 1 +
 htdocs/holiday/document.php           | 1 +
 htdocs/loan/document.php              | 1 +
 htdocs/projet/document.php            | 1 +
 htdocs/projet/tasks/document.php      | 1 +
 htdocs/societe/document.php           | 1 +
 htdocs/supplier_proposal/document.php | 1 +
 17 files changed, 17 insertions(+)

diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php
index 7860d36c9fb..47fbebbf976 100644
--- a/htdocs/adherents/document.php
+++ b/htdocs/adherents/document.php
@@ -158,6 +158,7 @@ if ($id > 0)
 
 		$modulepart = 'member';
 		$permission = $user->rights->adherent->creer;
+		$permtoedit = $user->rights->adherent->creer;
 		$param = '&id=' . $object->id;
 		include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
 		print "<br><br>";
diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php
index 668b093e7db..289ba272b8c 100644
--- a/htdocs/comm/propal/document.php
+++ b/htdocs/comm/propal/document.php
@@ -133,6 +133,7 @@ if ($object->id > 0)
 
 	$modulepart = 'propal';
 	$permission = $user->rights->propal->creer;
+	$permtoedit = $user->rights->propal->creer;
 	$param = '&id=' . $object->id;
 	include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
 }
diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php
index 6b96940df98..a05a6e0061d 100644
--- a/htdocs/commande/document.php
+++ b/htdocs/commande/document.php
@@ -121,6 +121,7 @@ if ($id > 0 || ! empty($ref))
 
 		$modulepart = 'commande';
 		$permission = $user->rights->commande->creer;
+		$permtoedit = $user->rights->commande->creer;
 		$param = '&id=' . $object->id;
 		include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
 	}
diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php
index a014bdc5d60..4c2182bb1e8 100644
--- a/htdocs/compta/bank/document.php
+++ b/htdocs/compta/bank/document.php
@@ -217,6 +217,7 @@ if ($id > 0 || !empty($ref)) {
 }
 else {
     Header('Location: index.php');
+    exit;
 }
 
 
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index 9a15b7875d8..246e5595779 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -149,6 +149,7 @@ if ($id > 0 || ! empty($ref))
 
 		$modulepart = 'facture';
 		$permission = $user->rights->facture->creer;
+		$permtoedit = $user->rights->facture->creer;
 		$param = '&id=' . $object->id;
 		include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
 
diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php
index 988dfc28dad..8c79dfd1580 100644
--- a/htdocs/contact/document.php
+++ b/htdocs/contact/document.php
@@ -138,6 +138,7 @@ if ($object->id)
     
     $modulepart = 'contact';
     $permission = $user->rights->societe->contact->creer;
+    $permtoedit = $user->rights->societe->contact->creer;
     $param = '&id=' . $object->id;
     include DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
 } else {
diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php
index 024cf561fb5..ef7e73ad4c8 100644
--- a/htdocs/contrat/document.php
+++ b/htdocs/contrat/document.php
@@ -124,6 +124,7 @@ if ($object->id)
 
     $modulepart = 'contract';
     $permission = $user->rights->contrat->creer;
+    $permtoedit = $user->rights->contrat->creer;
     $param = '&id=' . $object->id;
     include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
 
diff --git a/htdocs/don/document.php b/htdocs/don/document.php
index 4992e5dbbc8..4c5ae99e298 100644
--- a/htdocs/don/document.php
+++ b/htdocs/don/document.php
@@ -122,6 +122,7 @@ if ($object->id)
 
     $modulepart = 'don';
     $permission = $user->rights->don->lire;
+    $permtoedit = $user->rights->don->creer;
     $param = '&id=' . $object->id;
     include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
 
diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php
index 59a3bbf3c5d..a0bc97a17af 100644
--- a/htdocs/fichinter/document.php
+++ b/htdocs/fichinter/document.php
@@ -121,6 +121,7 @@ if ($object->id)
 
     $modulepart = 'ficheinter';
     $permission = $user->rights->ficheinter->creer;
+    $permtoedit = $user->rights->ficheinter->creer;
     $param = '&id=' . $object->id;
     include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
 
diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php
index cd6542a2810..35594d0f012 100644
--- a/htdocs/fourn/commande/document.php
+++ b/htdocs/fourn/commande/document.php
@@ -161,6 +161,7 @@ if ($object->id > 0)
 
 	$modulepart = 'commande_fournisseur';
 	$permission = $user->rights->fournisseur->commande->creer;
+	$permtoedit = $user->rights->fournisseur->commande->creer;
 	$param = '&id=' . $object->id;
 	include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
 
diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php
index 3ca1c2d05fa..c9a40f9b590 100644
--- a/htdocs/fourn/facture/document.php
+++ b/htdocs/fourn/facture/document.php
@@ -208,6 +208,7 @@ if ($object->id > 0)
 
 	$modulepart = 'facture_fournisseur';
 	$permission = $user->rights->fournisseur->facture->creer;
+	$permtoedit = $user->rights->fournisseur->facture->creer;
 	$param = '&facid=' . $object->id;
 	include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
 }
diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php
index 4f45704a269..edc85ca0060 100644
--- a/htdocs/holiday/document.php
+++ b/htdocs/holiday/document.php
@@ -222,6 +222,7 @@ if ($object->id)
 
     $modulepart = 'holiday';
     $permission = $user->rights->holiday->write;
+    $permtoedit = $user->rights->holiday->write;
     $param = '&id=' . $object->id;
     include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
 }
diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php
index 7463da4a190..732d8193638 100644
--- a/htdocs/loan/document.php
+++ b/htdocs/loan/document.php
@@ -157,6 +157,7 @@ if ($object->id)
 
     $modulepart = 'loan';
     $permission = $user->rights->loan->write;
+    $permtoedit = $user->rights->loan->write;
     $param = '&id=' . $object->id;
     include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
 }
diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php
index d59dec0dc4a..5485834ea26 100644
--- a/htdocs/projet/document.php
+++ b/htdocs/projet/document.php
@@ -148,6 +148,7 @@ if ($object->id > 0)
 
 	$modulepart = 'project';
 	$permission = ($userWrite > 0);
+	$permtoedit = ($userWrite > 0);
 	include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
 
 }
diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php
index c9a69fc81a4..370ee117169 100644
--- a/htdocs/projet/tasks/document.php
+++ b/htdocs/projet/tasks/document.php
@@ -242,6 +242,7 @@ if ($object->id > 0)
 	if ($withproject) $param .= '&withproject=1';
 	$modulepart = 'project_task';
 	$permission = $user->rights->projet->creer;
+	$permtoedit = $user->rights->projet->creer;
 	$relativepathwithnofile=dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref).'/';
 	include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
 }
diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php
index e64c9c49656..d83822c2cd7 100644
--- a/htdocs/societe/document.php
+++ b/htdocs/societe/document.php
@@ -156,6 +156,7 @@ if ($object->id)
 
 	$modulepart = 'societe';
 	$permission = $user->rights->societe->creer;
+	$permtoedit = $user->rights->societe->creer;
 	$param = '&id=' . $object->id;
 	include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
 }
diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php
index 77844225720..d8c51a45152 100644
--- a/htdocs/supplier_proposal/document.php
+++ b/htdocs/supplier_proposal/document.php
@@ -115,6 +115,7 @@ if ($object->id > 0)
 
 	$modulepart = 'supplier_proposal';
 	$permission = $user->rights->supplier_proposal->creer;
+	$permtoedit = $user->rights->supplier_proposal->creer;
 	$param = '&id=' . $object->id;
 	include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
 }
-- 
GitLab