pluginsGLPI / fields

Additionals fields for GLPI
http://glpi-plugins.rtfd.io/en/latest/fields/index.html
GNU General Public License v2.0
90 stars 66 forks source link

Issue with updating Fields plugin on GLPI 10 #806

Closed kvnwszr closed 3 months ago

kvnwszr commented 3 months ago

I'm facing an issue while updating the "Fields" plugin on GLPI 10. After attempting the update via the plugin management interface, the process does not complete successfully. The following errors are logged in the php-errors.log file:

[2024-07-02 14:46:44] glpiphplog.CRITICAL: *** Uncaught Exception Error: Class "PluginFields0caseacocher" not found in /var/www/html/glpi/marketplace/fields/inc/container.class.php at line 643
Backtrace :
marketplace/fields/inc/container.class.php:355 PluginFieldsContainer::create()
marketplace/fields/hook.php:86 PluginFieldsContainer::installUserData()
src/Plugin.php:922 plugin_fields_install()
: Plugin->install()
src/Marketplace/Controller.php:546 call_user_func()
src/Marketplace/Controller.php:436 Glpi\Marketplace\Controller->setPluginState()
ajax/marketplace.php:83 Glpi\Marketplace\Controller->installPlugin()
public/index.php:82 require()

Context:

The class PluginFields0caseacocher is not found when executing the PluginFieldsContainer::create() method. The create method attempts to generate a class name based on item types and field names, then calls the install() method on this class. The getClassname method seems to generate incorrect class names or the corresponding classes do not exist.

Actions Taken:

Executed the command composer install --no-dev in the plugin directory to ensure all dependencies are correctly installed.

Relevant Logs:

php-errors.log:

[2024-07-02 14:46:44] glpiphplog.CRITICAL: *** Uncaught Exception Error: Class "PluginFields0caseacocher" not found in /var/www/html/glpi/marketplace/fields/inc/container.class.php at line 643
Backtrace :
marketplace/fields/inc/container.class.php:355 PluginFieldsContainer::create()
marketplace/fields/hook.php:86 PluginFieldsContainer::installUserData()
src/Plugin.php:922 plugin_fields_install()
: Plugin->install()
src/Marketplace/Controller.php:546 call_user_func()
src/Marketplace/Controller.php:436 Glpi\Marketplace\Controller->setPluginState()
ajax/marketplace.php:83 Glpi\Marketplace\Controller->installPlugin()
public/index.php:82 require()

Request for Assistance:

I seek your assistance in resolving this issue with updating the Fields plugin on GLPI 10. Any information or assistance regarding the correction of the class not found error would be greatly appreciated.

stonebuzz commented 3 months ago

Can you force an update (fields should migrate 0 as zero ) with

php bin/console glpi:plugin:install fields -f

then

php bin/console glpi:plugin:activate fields

kvnwszr commented 3 months ago

Thank you for your response. The commands are also not working.

[root@gloopy glpi]# php bin/console glpi:plugin:install fields -f
User to use:glpi
Traitement du plugin « fields »...
Installation des tables MySQL
Uncaught Exception Error: Class "PluginFields0caseacocher" not found in /var/www/html/glpi/marketplace/fields/inc/container.class.php at line 643
stonebuzz commented 3 months ago

CAn you check from

glpi/files/_plugins/fields/inc/ what is the name of the file linked to this class

can you upload the file here ?

kvnwszr commented 3 months ago

I have checked all files in glpi/files/_plugins/fields/inc/ and I couldn't find any reference to this class.

stonebuzz commented 3 months ago

during GLPI update did you take over the glpi/_files/ folder?

kvnwszr commented 3 months ago

No, I did not modify the glpi/_files/ folder during the GLPI update.

stonebuzz commented 3 months ago

the plugin fields writes files in the folder glpi/files/_plugins/ which must be included if you update GLPI using this procedure

https://glpi-install.readthedocs.io/fr/latest/update.html

Can you give me the result of the following SQL query?

SELECT * from glpi_plugin_fields_containers

kvnwszr commented 3 months ago

I followed this procedure carefully Here is the result of the query

Capture d’écran 2024-07-02 162750

stonebuzz commented 3 months ago

Ok, drop line with ID 14 (itemtypes = ["0"] -> not possible)

DELETE FROM glpi_plugin_fields_containers WHERE id = 14

and it should work properly

kvnwszr commented 3 months ago

it worked thanks a lot for your help