Skip to content

Commit

Permalink
improve perf searching ids in dropdowns
Browse files Browse the repository at this point in the history
  • Loading branch information
cconard96 authored and trasher committed Aug 23, 2024
1 parent f6b526b commit 137fa6f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions src/Dropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 137fa6f

Please sign in to comment.