Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glpi 10.0.15: after updating fields's plugin to 1.21.10, in plugin datainjection, the mappings is empty #801

Closed
hcimadomo-procsi opened this issue Jun 28, 2024 · 5 comments

Comments

@hcimadomo-procsi
Copy link

glpi 10.0.15
Hello,
After updating field plugin to 1.21.10, in plugin datainjection, the mappings is empty. After search in log, i found error in php-error.log.
trace stack is
image
any idea ?
Best regards

@hcimadomo-procsi
Copy link
Author

hcimadomo-procsi commented Jun 28, 2024

hello,
in fact, after uninstall and reinstall plugin field (v1.21.10) and datainjection (v2.13.5), the mapping is now present. But the fields of bloc not appair. for exemple, i have bloc "ordinateur" with 3 fields
image
and the mapping not show it (choice of field is empty)
image
After search in php-error.log, i found:
image

help ..
Best regards

@Juinness
Copy link

Juinness commented Jul 4, 2024

I have found a solution.
When a field object is created, a class is generated in the folder files/_plugins/fields/inc/.
In the static method get_table($classname = null) the name of the same class is expected as parameter.

The Datainjection-Plugin calls the method without parameters so an empty string is always returned.

To fix the error, I recommend adapting the template plugins/fields/templates/injection.class.tpl as follows:

FROM

static function getTable($classname = null) {
        if ($classname === null) {
            return '';
        }
        $parent_class = get_parent_class($classname);

        if ($parent_class === false) {
            return '';
        }

        return getTableForItemType($parent_class);
}

TO

static function getTable() {
        return getTableForItemType($parent_class);
}

The field object must then be recreated so that the class with the fix is generated.

@stonebuzz
Copy link
Contributor

stonebuzz commented Jul 4, 2024

Please apply this =)

#807

you need to regenerate container after applying fix

@Juinness
Copy link

Juinness commented Jul 4, 2024

Please apply this =)

#807

you need to regenerate container after applying fix

Oh, I missed the PR. Use the Solution From @stonebuzz

@stonebuzz
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants