pluginsGLPI / formcreator

GLPI Plugin Formcreator (DOWNLOAD : https://github.com/pluginsGLPI/formcreator/releases)
http://www.teclib-edition.com
GNU General Public License v3.0
174 stars 125 forks source link

Error in apresentation of fields "GLPI Objects" #3304

Closed paulo-dambros closed 1 year ago

paulo-dambros commented 1 year ago

Describe the bug After updating GLPI to 10.0.7 and FormCreator to 2.13.6, the fields of type "GLPI Object" in the "Selectable Root" field are not disabling the chosen level.

To Reproduce Steps to reproduce the behavior: Update a question form. Choose the option "GLPI Objects" for the type. Select "No" for the root level. Verify the behavior in the form preview.

Expected behavior The expected behavior is that it does not allow the selection of the root entity.

Screenshots The images compare the old and new configurations and the behavior in the old and new form. In configuration image

In form image

btry commented 1 year ago

Hi

It works well for me. Your problem may be related to a not up to date cache.

Can you check in the database the column sons_cache of the entity UNEMAT ? Is the value OK with the list of all childs of the entity ? If not, set sons_cache to the value NULL, then clear the cache of GLPI (in configuration > general > performance > User Data Cache). Finally refresh the form's page and see if it helps.

paulo-dambros commented 1 year ago

Hello, thank you for the feedback. The sons_cache column was NULL. And I can't clear the GLPI cache via the interface, unfortunately. I cleared the cache using the command "php bin/console glpi:cache:clear," but it broke the functionality of Formcreator, with the messages "The database schema is not consistent with the Formcreator version 2.13.0. To view the logs, execute the command bin/console glpi:plugin:install formcreator -f." Now I will try to recover the installation to proceed after your recommendation.

btry commented 1 year ago

Hi

unfortunately. I cleared the cache using the command "php bin/console glpi:cache:clear," but it broke the functionality of Formcreator, with the messages "The database schema is not consistent with the Formcreator version 2.13.0

Ok, let's fix this.

Open a terminal in your server, move to GLPI's directory

paulo-dambros commented 1 year ago

Hello, great, I will do that, but I'm working in a testing environment, so I reset the work and will see how the latest GLPI update behaves. Thank you very much indeed!

paulo-dambros commented 1 year ago

Hello, I executed the command, and it didn't show any errors. Through the interface, I reactivated the formcreator plugin, but it still has the same issue.

btry commented 1 year ago

I executed the command, and it didn't show any errors

What is the output ?

paulo-dambros commented 1 year ago

Processing plugin "formcreator"... The tables of the plugin passed the schema integrity check. The "formcreator" plugin has been installed and can now be activated.

btry commented 1 year ago

Run again the command with this extra argument -p force-upgrade

Next run PHP bon/console db:check -p formcreator

What is the output of both commands?

paulo-dambros commented 1 year ago

After running the command "PHP bin/console db:check -p formcreator," the console displayed: The "formcreator" plugin was not found or was not activated.

So, I reactivated the plugin and ran the command again. And it displayed: The database schema is OK.

But I noticed something regarding permissions in the directory. I will check.

btry commented 1 year ago

The first command should run, no matter the plugin is inactive.

Check if you have 2 copies of Formcreator in the directories plugins/ and marketplace/ , just in case.

paulo-dambros commented 1 year ago

The first command was executed and did not produce any errors. The message "The 'formcreator' plugin was not found or was not activated" appears in the second command.

So, I need to reactivate the plugin and run the second command. Then it displays the message "The database schema is OK."

There was an ownership issue in the marketplace directory, which has been fixed. And there is no other 'formcreator' directory in the plugins directory.

After running a forced update, we noticed that there was still an available update through the interface. So, we went through the process via the interface, and it started working beautifully again.

Thanks to @btry for the immense help. Now we know how to solve the problem, and we'll share it here.

Thank you very much!

btry commented 1 year ago

Be careful with the argument forced-upgrade. Use it only if there are small database schema inconsistencies. If a table or a column is missing, forcing the upgrade may leave things worse. The best is to backup the whole Glpi instance If you have any doubt.

paulo-dambros commented 1 year ago

Yes, all commands were executed in a testing environment, separate from the production environment. Thanks!!