From 137fa6f2ee1234ef97e7cb14260092ee943f4221 Mon Sep 17 00:00:00 2001 From: Curtis Conard Date: Sat, 17 Aug 2024 05:40:55 -0400 Subject: [PATCH] improve perf searching ids in dropdowns --- CHANGELOG.md | 1 + src/Dropdown.php | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57e5f36510b..0d5ea8ed2d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The present file will list all changes made to the project; according to the ### Added ### Changed +- Searching IDs in dropdowns now matches the beginning of the ID instead of anywhere in the ID. ### Deprecated diff --git a/src/Dropdown.php b/src/Dropdown.php index 43463ff346f..c67c5c750f3 100644 --- a/src/Dropdown.php +++ b/src/Dropdown.php @@ -3169,10 +3169,9 @@ public static function getDropdownValue($post, $json = true) ]; if ( - $_SESSION['glpiis_ids_visible'] - && is_numeric($post['searchText']) && (int)$post['searchText'] == $post['searchText'] + $_SESSION['glpiis_ids_visible'] && (int) $post['searchText'] === $post['searchText'] ) { - $orwhere[$table . '.' . $item->getIndexName()] = ['LIKE', "%{$post['searchText']}%"]; + $orwhere[$table . '.' . $item::getIndexName()] = ['LIKE', "{$post['searchText']}%"]; } if ($item instanceof CommonDCModelDropdown) {