From 1ba11d24da2ffb55e2d2f190ea2375f79aa9121f Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Mon, 18 May 2026 03:24:07 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20#37795=20supplier=5Fproposal:=20Project?= =?UTF-8?q?=20assignment=20not=20saved=20=E2=80=93=20neither=20on=20creati?= =?UTF-8?q?on=20nor=20after=20(#38263)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jon Bendtsen --- htdocs/supplier_proposal/card.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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);