pluginsGLPI / genericobject

Genericobject object plugin
http://glpi-plugins.rtfd.io/en/latest/genericobject/index.html
GNU General Public License v3.0
53 stars 58 forks source link

fix(lang): reset lang before construct searchoption #361

Closed stonebuzz closed 1 year ago

stonebuzz commented 1 year ago

FormCreator allows you to use a tag targeting a property of the selected object (in a question)

ex :

##answer_1.Serial_number##

To do this, Formcreator changes language (en_GB) and load plugin languages to search for the property in searchOption

See : https://github.com/pluginsGLPI/formcreator/pull/3367

Even if you change your language, the plugin will not take this into account.

Because $GO_FIELDS is already computed with the language of the logged-in user

This PR forces the system to compute $GO_FIELD as soon as it requests the searchOption

stonebuzz commented 1 year ago

This method is used in loops, so forcing inclusion of all fields definition on each iteration may have a huge impact on performances. Is this possible to do a unique call to this function from formcreator itself?

This implies a strong link between the fields plugin and the genericobject plugin (I'm not a fan).

Maybe my last commit will be more appreciated =)