NEW: Show name_alias in parentheses in thirdparty dropdown lists (#37997)

Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>
This commit is contained in:
Zakaria Boushaba 2026-04-26 21:23:51 +01:00 committed by GitHub
parent 8a93c6215e
commit 6e4a5fff4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View file

@ -753,7 +753,7 @@ class FormCompany extends Form
return $socid;
} else {
// Search to list thirdparties
$sql = "SELECT s.rowid, s.nom as name ";
$sql = "SELECT s.rowid, s.nom as name, s.name_alias";
if (getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) {
$sql .= ", s.code_client, s.code_fournisseur";
}
@ -807,19 +807,20 @@ class FormCompany extends Form
if (is_array($limitto) && count($limitto) && !in_array($obj->rowid, $limitto)) {
$disabled = 1;
}
$nameAlias = !empty($obj->name_alias) ? ' (' . $obj->name_alias . ')' : '';
if ($selected > 0 && $selected == $obj->rowid) {
print '<option value="' . $obj->rowid . '"';
if ($disabled) {
print ' disabled';
}
print ' selected>' . dol_escape_htmltag($obj->name, 0, 0, '', 0, 1) . '</option>';
print ' selected>' . dol_escape_htmltag($obj->name, 0, 0, '', 0, 1) . $nameAlias . '</option>';
$firstCompany = $obj->rowid;
} else {
print '<option value="' . $obj->rowid . '"';
if ($disabled) {
print ' disabled';
}
print '>' . dol_escape_htmltag($obj->name, 0, 0, '', 0, 1) . '</option>';
print '>' . dol_escape_htmltag($obj->name, 0, 0, '', 0, 1) . $nameAlias . '</option>';
}
$i++;
}

View file

@ -159,6 +159,9 @@ if ($resql) {
}
$label .= $row['nom'];
if (!empty($row['name_alias'])) {
$label .= ' (' . $row['name_alias'] . ')';
}
if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
$label .= ($row['address'] ? ' - '.$row['address'] : '').($row['zip'] ? ' - '.$row['zip'] : '').($row['town'] ? ' '.$row['town'] : '');