Skip to content

Commit

Permalink
Look and feel v21: Combo of role must use the placeholder.
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Aug 14, 2024
1 parent fc9b9b7 commit d784bce
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
5 changes: 2 additions & 3 deletions htdocs/contact/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@
$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";
Expand Down Expand Up @@ -1043,8 +1043,7 @@
}

$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">';
Expand Down
19 changes: 10 additions & 9 deletions htdocs/core/class/html.formcompany.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -857,14 +857,15 @@ public function selectTypeContact($object, $selected, $htmlname = 'type', $sourc
/**
* 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();
Expand All @@ -874,7 +875,7 @@ public function showRoles($htmlname, Contact $contact, $rendermode = 'view', $se
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();
Expand All @@ -889,7 +890,7 @@ public function showRoles($htmlname, Contact $contact, $rendermode = 'view', $se
$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
Expand Down
2 changes: 2 additions & 0 deletions htdocs/langs/en_US/main.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions htdocs/theme/eldy/global.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -6731,7 +6731,7 @@
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;
Expand Down Expand Up @@ -6845,7 +6845,7 @@
}
.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;
Expand Down

0 comments on commit d784bce

Please sign in to comment.