Look and feel v21: Combo of role must use the placeholder.

This commit is contained in:
Laurent Destailleur 2024-08-14 14:39:58 +02:00
parent fc9b9b7c0d
commit d784bceeef
4 changed files with 16 additions and 14 deletions

View File

@ -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 .= '<div class="divsearchfield">';
$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 .= '</div>';
print '<div class="liste_titre liste_titre_bydiv centpercent">';

View File

@ -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 '<div class="select2-container-multi-dolibarr" style="width: 90%;" id="' . $htmlname . '"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
}
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

View File

@ -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

View File

@ -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;