diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 44dd60289f7..ebd3332d898 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -720,7 +720,7 @@ if (strlen($search_town)) {
$sql .= natural_search("p.town", $search_town);
}
if (count($search_roles) > 0) {
- $sql .= " AND p.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".$db->sanitize(implode(',', $search_roles))."))";
+ $sql .= " AND EXISTS (SELECT sc.rowid FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE p.rowid = sc.fk_socpeople AND sc.fk_c_type_contact IN (".$db->sanitize(implode(',', $search_roles))."))";
}
if ($search_no_email != -1 && $search_no_email > 0) {
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) > 0";
@@ -1043,8 +1043,7 @@ if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
}
$moreforfilter .= '
';
-$moreforfilter .= $langs->trans('Roles').': ';
-$moreforfilter .= $formcompany->showRoles("search_roles", $objecttmp, 'edit', $search_roles);
+$moreforfilter .= $formcompany->showRoles("search_roles", $objecttmp, 'edit', $search_roles, 'minwidth500', $langs->trans('ContactRoles'));
$moreforfilter .= '
';
print '';
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index e1da5b7a5a4..f806dd192d9 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -857,14 +857,15 @@ class FormCompany extends Form
/**
* showContactRoles on view and edit mode
*
- * @param string $htmlname Html component name and id
- * @param Contact $contact Contact Object
- * @param string $rendermode view, edit
- * @param array $selected $key=>$val $val is selected Roles for input mode
- * @param string $morecss More css
- * @return string String with contacts roles
+ * @param string $htmlname Html component name and id
+ * @param Contact $contact Contact Object
+ * @param string $rendermode view, edit
+ * @param array $selected $key=>$val $val is selected Roles for input mode
+ * @param string $morecss More css
+ * @param string $placeholder Placeholder text (used when $rendermode is 'edit')
+ * @return string String with contacts roles
*/
- public function showRoles($htmlname, Contact $contact, $rendermode = 'view', $selected = array(), $morecss = 'minwidth500')
+ public function showRoles($htmlname, Contact $contact, $rendermode = 'view', $selected = array(), $morecss = 'minwidth500', $placeholder = '')
{
if ($rendermode === 'view') {
$toprint = array();
@@ -874,7 +875,7 @@ class FormCompany extends Form
return '
' . implode(' ', $toprint) . '
';
}
- if ($rendermode === 'edit') {
+ if ($rendermode === 'edit') { // A multiselect combo list
$contactType = $contact->listeTypeContacts('external', '', 1, '', '', 'agenda'); // We exclude agenda as there is no contact on such element
if (count($selected) > 0) {
$newselected = array();
@@ -889,7 +890,7 @@ class FormCompany extends Form
$selected = $newselected;
}
}
- return $this->multiselectarray($htmlname, $contactType, $selected, 0, 0, $morecss, 0, '90%');
+ return $this->multiselectarray($htmlname, $contactType, $selected, 0, 0, $morecss, 0, '90%', '', '', $placeholder);
}
return 'ErrorBadValueForParameterRenderMode'; // Should not happened
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index c8e908ce11b..11599847644 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -1188,6 +1188,8 @@ SetSupervisor=Set the supervisor
CreateExternalUser=Create external user
ConfirmAffectTag=Bulk Tag Assignment
ConfirmAffectUser=Bulk User Assignment
+ContactRole=Contact role
+ContactRoles=Contact roles
ProjectRole=Role assigned on each project/opportunity
TasksRole=Role assigned on each task (if used)
ConfirmSetSupervisor=Bulk Supervisor Set
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index 5e0e7521032..efa8c0d0cea 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -6731,7 +6731,7 @@ input.select2-input {
color: #FFF !important;
}
.select2-container .select2-selection--multiple {
- min-height: 2.2em !important;
+ min-height: 2em !important;
}
.tableforfield .select2-container .select2-selection--single {
height: 25px;
@@ -6845,7 +6845,7 @@ input.select2-input {
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: #ddd;
- margin-top: 4px !important;
+ margin-top: 0.25em !important;
}
.select2-selection--multiple input.select2-search__field {
border-bottom: none !important;