Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ 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]

### Added

- Add compatibility with GLPI `CustomAsset`


## [1.23.2] - 2025-12-22

- Fix prevent failure when attempting to delete an actor
Expand Down
2 changes: 1 addition & 1 deletion hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ function plugin_fields_addWhere($link, $nott, $itemtype, $ID, $val, $searchtype)
/** @var DBmysql $DB */
global $DB;

$searchopt = &Search::getOptions($itemtype);
$searchopt = Search::getOptions($itemtype);
$table = $searchopt[$ID]['table'];
$field = $searchopt[$ID]['field'];
$pfields_type = $searchopt[$ID]['pfields_type'] ?? '';
Expand Down
6 changes: 5 additions & 1 deletion inc/container.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2013,7 +2013,11 @@ public static function getAddSearchOptions($itemtype, $containers_id = false)
// > To search for \, specify it as \\\\; this is because the backslashes are stripped
// > once by the parser and again when the pattern match is made,
// > leaving a single backslash to be matched against.
$search_string = str_replace('\\', '\\\\', $search_string);

// But do not escape backslashes for CustomAsset, as they are alrady escaped
if (!str_contains($search_string, 'CustomAsset')) {
$search_string = str_replace('\\', '\\\\', $search_string);
}

$request = [
'SELECT' => [
Expand Down
6 changes: 6 additions & 0 deletions inc/toolbox.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ public static function getGlpiItemtypes(): array
Socket::class,
];

foreach ($CFG_GLPI['asset_types'] as $asset_type) {
if (str_starts_with((string) $asset_type, "Glpi\CustomAsset")) {
$assets_itemtypes[] = $asset_type;
}
}

$assistance_itemtypes = [
Ticket::class,
Problem::class,
Expand Down