Skip to content
Closed
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
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]

### Fixed

- Prevent a crash on the service catalog page when plugin files are updated before the database schema migration is applied.

## [1.14.0] - 2026-04-30

### Added
Expand Down
12 changes: 12 additions & 0 deletions inc/alert.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,21 @@ public static function displayOnTicket()

public static function displayOnServiceCatalog()
{
if (!self::hasServiceCatalogDisplayFlag()) {
return;
}

self::displayAlerts(['show_only_service_catalog_alerts' => true]);
}

private static function hasServiceCatalogDisplayFlag(): bool
{
/** @var DBmysql $DB */
global $DB;

return $DB->fieldExists(self::getTable(), 'is_displayed_onservicecatalog');
}

public static function displayAlerts($params = [])
{
/** @var array $CFG_GLPI */
Expand Down
11 changes: 7 additions & 4 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ function plugin_init_news()
/**
* @var array $PLUGIN_HOOKS
* @var array $CFG_GLPI
* @var DBmysql $DB
*/
global $PLUGIN_HOOKS, $CFG_GLPI;
global $PLUGIN_HOOKS, $CFG_GLPI, $DB;

$PLUGIN_HOOKS['csrf_compliant']['news'] = true;

Expand All @@ -62,9 +63,11 @@ function plugin_init_news()
$PLUGIN_HOOKS['display_central']['news'] = [
'PluginNewsAlert', 'displayOnCentral',
];
$PLUGIN_HOOKS['display_service_catalog']['news'] = [
'PluginNewsAlert', 'displayOnServiceCatalog',
];
if ($DB->fieldExists(PluginNewsAlert::getTable(), 'is_displayed_onservicecatalog')) {
$PLUGIN_HOOKS['display_service_catalog']['news'] = [
'PluginNewsAlert', 'displayOnServiceCatalog',
];
}
$PLUGIN_HOOKS['pre_item_list']['news'] = ['PluginNewsAlert', 'preItemList'];

$PLUGIN_HOOKS['pre_item_form']['news'] = ['PluginNewsAlert', 'preItemForm'];
Expand Down