diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 64682c9d3dece..b8e0cebc06d06 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1442,8 +1442,14 @@ function init_repeat() $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 ''; }