diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php
index aff77ce7285..4177c4237b8 100644
--- a/htdocs/core/class/html.formprojet.class.php
+++ b/htdocs/core/class/html.formprojet.class.php
@@ -505,7 +505,7 @@ class FormProjets
}
$linkedtothirdparty = false;
- if (!in_array($table_element, array('don', 'expensereport_det', 'expensereport', 'loan', 'stock_mouvement', 'payment_salary', 'payment_various', 'chargesociales'))) {
+ if (!in_array($table_element, array('don', 'expensereport_det', 'expensereport', 'loan', 'stock_mouvement', 'payment_salary', 'payment_various', 'chargesociales', 'entrepot'))) {
$linkedtothirdparty = true;
}
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index 33a0fafb5dc..d14e52d14e8 100644
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -89,6 +89,7 @@ TimeConsumed=Consumed
ListOfTasks=List of tasks
GoToListOfTimeConsumed=Go to list of time consumed
GanttView=Gantt View
+ListWarehouseAssociatedProject=List of warehouses associated to the project
ListProposalsAssociatedProject=List of the commercial proposals related to the project
ListOrdersAssociatedProject=List of sales orders related to the project
ListInvoicesAssociatedProject=List of customer invoices related to the project
diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang
index a963bffe13d..d7f3997a019 100644
--- a/htdocs/langs/fr_FR/projects.lang
+++ b/htdocs/langs/fr_FR/projects.lang
@@ -89,6 +89,7 @@ TimeConsumed=Consommé
ListOfTasks=Liste de tâches
GoToListOfTimeConsumed=Aller à la liste des temps consommés
GanttView=Vue Gantt
+ListWarehouseAssociatedProject=Liste des entrepôts associés au projet
ListProposalsAssociatedProject=Liste des propositions commerciales associées au projet
ListOrdersAssociatedProject=Liste des commandes clients associées au projet
ListInvoicesAssociatedProject=Liste des factures clients associées au projet
diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php
index 7f2f8f58bb5..dc5f01bb666 100644
--- a/htdocs/product/stock/card.php
+++ b/htdocs/product/stock/card.php
@@ -41,6 +41,7 @@ $langs->loadLangs(array('products', 'stocks', 'companies', 'categories'));
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm');
+$projectid = GETPOST('projectid', 'int');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 50ac450e136..5032cc27a89 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -1778,6 +1778,9 @@ class Project extends CommonObject
if ($tableName == "actioncomm") {
$sql .= " SET fk_project=".$this->id;
$sql .= " WHERE id=".$elementSelectId;
+ } elseif ($tableName == "entrepot") {
+ $sql .= " SET fk_project=".$this->id;
+ $sql .= " WHERE rowid=".$elementSelectId;
} else {
$sql .= " SET fk_projet=".$this->id;
$sql .= " WHERE rowid=".$elementSelectId;
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index a71d8c4a602..c4bba305fb4 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -7,6 +7,7 @@
* Copyright (C) 2015 Marcos García
* Copyright (C) 2016 Josep Lluís Amador
* Copyright (C) 2021 Gauthier VERDOL
+ * Copyright (C) 2021 Noé Cendrier
*
* 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
@@ -360,6 +361,18 @@ print '
';
*/
$listofreferent = array(
+'entrepot'=>array(
+ 'name'=>"Warehouse",
+ 'title'=>"ListWarehouseAssociatedProject",
+ 'class'=>'Entrepot',
+ 'table'=>'entrepot',
+ 'datefieldname'=>'date_entrepot',
+ 'urlnew'=>DOL_URL_ROOT.'/product/stock/card.php?action=create&projectid='.$id,
+ 'lang'=>'entrepot',
+ 'buttonnew'=>'AddWarehouse',
+ 'project_field'=>'fk_project',
+ 'testnew'=>$user->rights->stock->creer,
+ 'test'=>$conf->stock->enabled && $user->rights->stock->lire),
'propal'=>array(
'name'=>"Proposals",
'title'=>"ListProposalsAssociatedProject",