Skip to content

Commit

Permalink
fix(Impact): use genericobject/front/getimpacticon.php to serve icon
Browse files Browse the repository at this point in the history
  • Loading branch information
stonebuzz authored Jan 8, 2024
1 parent 872182a commit b7f05dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions inc/type.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2829,13 +2829,13 @@ public function getImpactIconFilePath(): ?string
*
* @return null|string
*/
public function getImpactIconUrl(): ?string
public function getImpactIconUrl($full = true): ?string
{
// Check that the file exist
if (!$this->getImpactIconFilePath()) {
return null;
}

return Plugin::getWebDir('genericobject') . "/front/getimpacticon.php?itemtype=" . $this->fields['itemtype'];
return Plugin::getWebDir('genericobject', $full) . "/front/getimpacticon.php?itemtype=" . $this->fields['itemtype'];
}
}
8 changes: 3 additions & 5 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,9 @@ function plugin_init_genericobject()
if (empty($row['impact_icon'])) {
$icon = ""; // Will fallback to default impact icon
} else {
$icon = PluginGenericobjectType::getImpactIconFileStoragePath(
$row['impact_icon'],
$row['itemtype'],
true
) ?? "";
$obj = new PluginGenericobjectType();
$obj->getFromDB($row['id']);
$icon = $obj->getImpactIconUrl(false) ?? "";
}

$CFG_GLPI['impact_asset_types'][$row['itemtype']] = $icon;
Expand Down

0 comments on commit b7f05dd

Please sign in to comment.