From 0912b3b04f026f668a527cc99cbbc9ccf341752e Mon Sep 17 00:00:00 2001 From: uvaldenaire-opendsi Date: Thu, 9 Jan 2025 15:04:37 +0100 Subject: [PATCH] fix selectcontacts param --- htdocs/comm/action/card.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 99d330b745a..0310ac0b225 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1181,8 +1181,14 @@ if ($action == 'create') { $preselectedids[GETPOST('contactid', 'int')] = GETPOST('contactid', 'int'); } if ($origin=='contact') $preselectedids[GETPOST('originid', 'int')] = GETPOST('originid', 'int'); + // select "all" or "none" contact by default + if (getDolGlobalInt('MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT')) { + $select_contact_default = 0; // select "all" contacts by default : avoid to use it if there is a lot of contacts + } else { + $select_contact_default = -1; // select "none" by default + } print img_picto('', 'contact', 'class="paddingrightonly"'); - print $form->selectcontacts(GETPOST('socid', 'int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid'); + print $form->selectcontacts(GETPOSTISSET('socid') ? GETPOSTINT('socid') : $select_contact_default, $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid'); print ''; }