Skip to content

Commit 8b34f0f

Browse files
authored
Fix - Use getTableForItemType() for custom dropdown search options to resolve correct shared table name (#1147)
* Fix - Use getTableForItemType() for custom dropdown search options to resolve correct shared table name * Update CHANGELOG
1 parent 2769aff commit 8b34f0f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [UNRELEASED]
9+
10+
### Fixed
11+
12+
- Fix SQL errors with custom dropdown fields
13+
814
## [1.23.3] - 2026-02-12
915

1016
### Added

inc/container.class.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,8 +2217,10 @@ public static function getAddSearchOptions($itemtype, $containers_id = false)
22172217
$opt[$i]['datatype'] = 'specific';
22182218
$opt[$i]['searchtype'] = ['equals', 'notequals'];
22192219
} else {
2220-
$opt[$i]['table'] = CommonDBTM::getTable($dropdown_matches['class']);
2221-
$opt[$i]['field'] = 'name';
2220+
$opt[$i]['table'] = getTableForItemType($dropdown_matches['class']);
2221+
$opt[$i]['field'] = is_a($dropdown_matches['class'], CommonTreeDropdown::class, true)
2222+
? 'completename'
2223+
: 'name';
22222224
$opt[$i]['right'] = 'all';
22232225
$opt[$i]['datatype'] = 'dropdown';
22242226

0 commit comments

Comments
 (0)