Skip to content

Commit

Permalink
Add itemtype, item ans path injection for Database instance (#432)
Browse files Browse the repository at this point in the history
* Add itemtype, item ans path injection for Database instance

* Fix category dropdown value

* Remove items_name and itemtype option

* Update inc/databaseinstanceinjection.class.php

Co-authored-by: Romain B. <[email protected]>

* Update inc/databaseinstanceinjection.class.php

Co-authored-by: Romain B. <[email protected]>

* Add comments

* Update changelog

---------

Co-authored-by: Romain B. <[email protected]>
  • Loading branch information
Lainow and Rom1-B authored Nov 29, 2024
1 parent be8b1f0 commit 076858a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Added

- Add injection of the ```Itemtype```, ```Item``` and ```Path``` for the database instance

### Fixed

- Fix default entity insertion for a user
Expand Down
4 changes: 3 additions & 1 deletion inc/databaseinstanceinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function isPrimaryType()
public function connectedTo()
{

return [];
return [\Glpi\Inventory\Asset\Computer::class];
}


Expand All @@ -64,11 +64,13 @@ public function getOptions($primary_type = '')
{

$tab = Search::getOptions(get_parent_class($this));
$tab[5]['linkfield'] = 'items_id'; // 5 = databaseinstance items_id Search option

//Remove some options because some fields cannot be imported
$blacklist = PluginDatainjectionCommonInjectionLib::getBlacklistedOptions(get_parent_class($this));
$notimportable = [];
$options['ignore_fields'] = array_merge($blacklist, $notimportable);
$options['displaytype'] = ["dropdown" => [40]];


return PluginDatainjectionCommonInjectionLib::addToSearchOptions($tab, $options, $this);
Expand Down

0 comments on commit 076858a

Please sign in to comment.