diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php
index 058706edce7..9586adeaed4 100644
--- a/htdocs/core/class/html.formprojet.class.php
+++ b/htdocs/core/class/html.formprojet.class.php
@@ -368,6 +368,7 @@ class FormProjets
} else $out .= ' ';
$out .= '';
}
+
$num = $this->db->num_rows($resql);
$i = 0;
if ($num)
@@ -388,6 +389,18 @@ class FormProjets
$labeltoshow = '';
+ $disabled = 0;
+ if ($obj->fk_statut == Project::STATUS_DRAFT)
+ {
+ $disabled = 1;
+ } elseif ($obj->fk_statut == Project::STATUS_CLOSED)
+ {
+ if ($discard_closed == 2) $disabled = 1;
+ } elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid))
+ {
+ $disabled = 1;
+ }
+
if ($showproject == 'all')
{
$labeltoshow .= dol_trunc($obj->ref, 18); // Project ref