diff --git a/CHANGELOG.md b/CHANGELOG.md index ca4765d5..d85fa3d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [UNRELEASED] + +### Fixed + +- Fix SQL errors with custom dropdown fields + ## [1.23.3] - 2026-02-12 ### Added diff --git a/inc/container.class.php b/inc/container.class.php index 4f9f3656..12f685e9 100644 --- a/inc/container.class.php +++ b/inc/container.class.php @@ -2217,8 +2217,10 @@ public static function getAddSearchOptions($itemtype, $containers_id = false) $opt[$i]['datatype'] = 'specific'; $opt[$i]['searchtype'] = ['equals', 'notequals']; } else { - $opt[$i]['table'] = CommonDBTM::getTable($dropdown_matches['class']); - $opt[$i]['field'] = 'name'; + $opt[$i]['table'] = getTableForItemType($dropdown_matches['class']); + $opt[$i]['field'] = is_a($dropdown_matches['class'], CommonTreeDropdown::class, true) + ? 'completename' + : 'name'; $opt[$i]['right'] = 'all'; $opt[$i]['datatype'] = 'dropdown';