2
0
forked from Wavyzz/dolibarr

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

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