From 42aba4b09f04a8b50f4307f02282bdf3978291e1 Mon Sep 17 00:00:00 2001 From: "Romain B." <8530352+Rom1-B@users.noreply.github.com> Date: Wed, 25 Nov 2026 10:53:53 +0100 Subject: [PATCH] Fix: clarify required GenericObject version on migration (#1351) --- CHANGELOG.md | 1 + inc/migration.class.php | 3 ++- tests/Units/FieldGenericObjectMigrationTest.php | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a344b677..d63779fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fix `Some mandatory fields are empty` error displayed when creating an item with an assigned technician - Fix item creation failing when a Yes/No field has a non boolean default value - Fix search on number fields: `is` / `is not` ignoring values from 1000, `<` / `>` comparing values as text, and `is not` excluding items without value +- Fix GenericObject migration error message to name the required 3.0.x version ## [1.25.1] - 2026-10-28 diff --git a/inc/migration.class.php b/inc/migration.class.php index f15d088a..cac1b166 100644 --- a/inc/migration.class.php +++ b/inc/migration.class.php @@ -272,8 +272,9 @@ public static function getGenericObjectTypes(): array // Check GenericObject version $genericobject_info = Plugin::getInfo('genericobject'); if (version_compare($genericobject_info['version'] ?? '0', '3.0.0', '<')) { + // GitHub "latest" release is the GLPI 10 branch (2.14.x), so 3.0.x must be named explicitly. throw new RuntimeException( - 'GenericObject plugin cannot be migrated. Please update it to the latest version.', + 'GenericObject plugin cannot be migrated: version 3.0.x is required. Please install the latest 3.0.x release.', ); } diff --git a/tests/Units/FieldGenericObjectMigrationTest.php b/tests/Units/FieldGenericObjectMigrationTest.php index 1009f51c..e69bdb1d 100644 --- a/tests/Units/FieldGenericObjectMigrationTest.php +++ b/tests/Units/FieldGenericObjectMigrationTest.php @@ -101,6 +101,7 @@ public function testMigrationGuardTriggersWhenGenericobjectFieldsExist(): void $this->fail('Expected RuntimeException was not thrown.'); } catch (RuntimeException $runtimeException) { $this->assertStringContainsString('GenericObject plugin cannot be migrated', $runtimeException->getMessage()); + $this->assertStringContainsString('version 3.0.x is required', $runtimeException->getMessage()); } $this->hasPhpLogRecordThatContains(