diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php
index e7d14037632..5a4e6cc5de7 100644
--- a/htdocs/supplier_proposal/card.php
+++ b/htdocs/supplier_proposal/card.php
@@ -1412,7 +1412,11 @@ if ($action == 'create') {
print '
';
print '| '.$langs->trans("Project").' | ';
- print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
+ $canLinkAll = getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS');
+ $canLinkAll = ($canLinkAll === '' || $canLinkAll === false) ? 0 : $canLinkAll;
+ $currentSocId = ($object->id > 0) ? $object->socid : $socid;
+ $projectSocId = ((int) $canLinkAll == 1) ? -1 : $currentSocId;
+ print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects($projectSocId, $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
print ' id).'">';
print ' | ';
@@ -1655,7 +1659,11 @@ if ($action == 'create') {
if ($action != 'classify') {
$morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' ';
}
- $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
+ $canLinkAll = getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS');
+ $canLinkAll = ($canLinkAll === '' || $canLinkAll === false) ? 0 : $canLinkAll;
+ $currentSocId = ($object->id > 0) ? $object->socid : $socid;
+ $projectSocId = ((int) $canLinkAll == 1) ? -1 : $currentSocId;
+ $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $projectSocId, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);