Skip to content

Migration tool fails when duplicate names exist across different trees #3617

@AurumAeternum

Description

@AurumAeternum

We are migrating forms from the Formcreator plugin to native GLPI 11 forms using the CLI command:

php bin/console glpi:migration:formcreator_plugin_to_core

During execution, the migration fails with errors like:

ITILCategory::getFromDBByCrit() expects to get one result, 2 found in query "SELECT id FROM glpi_itilcategories WHERE name = 'Pessoa Física'"

This happens even though the categories with the same name belong to different branches of the tree:

  • CADASTRO > Clients > Inclusion > Pessoa Física
  • CADASTRO > Suppliers > Inclusion > Pessoa Física
    The same issue occurs with glpi_locations, glpi_entities, and other hierarchical objects.

The migration tool uses getFromDBByCrit() with only the name field to resolve references. This causes ambiguity when multiple records share the same name, even if their completename or id is unique and clearly distinguishes them.
This behavior is problematic because:

  • It breaks migration for valid hierarchical structures
  • It ignores the primary key (id), which should be the definitive reference
  • It requires manual renaming or deletion of records, which is risky and error-prone

This issue affects any GLPI instance with:

  • Deep hierarchical structures
  • Repeated names across different branches
  • Large-scale form usage with complex visibility conditions
    It blocks migration and forces administrators to manually sanitize data, which is not scalable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions