ocsinventoryng icon indicating copy to clipboard operation
ocsinventoryng copied to clipboard

when OCS plugin enabled on GLPI 11 the computers list broke

Open fgendorf opened this issue 5 months ago • 5 comments

Hi, Thanks for that update, but after enable de OCS plugin the computer list stop works and in error_log has the following:

[2025-10-02 09:11:54] glpi.CRITICAL:   *** Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("DbUtils::getClassForItemtype(): Argument #1 ($itemtype) must be of type string, null given, called in ./src/DbUtils.php on line 549") in "pages/generic_list.html.twig" at line 37." at generic_list.html.twig line 37
  Backtrace :
  ./templates/pages/generic_list.html.twig:37        
  ./vendor/twig/twig/src/Template.php:358            Twig\Template->yield()
  ./vendor/twig/twig/src/Template.php:373            Twig\Template->display()
  ./vendor/twig/twig/src/TemplateWrapper.php:51      Twig\Template->render()
  .../Glpi/Application/View/TemplateRenderer.php:170 Twig\TemplateWrapper->render()
  ./src/Glpi/Controller/AbstractController.php:68    Glpi\Application\View\TemplateRenderer->render()
  ./src/Glpi/Controller/GenericListController.php:51 Glpi\Controller\AbstractController->render()
  ./vendor/symfony/http-kernel/HttpKernel.php:181    Glpi\Controller\GenericListController->__invoke()
  ./vendor/symfony/http-kernel/HttpKernel.php:76     Symfony\Component\HttpKernel\HttpKernel->handleRaw()
  ./vendor/symfony/http-kernel/Kernel.php:197        Symfony\Component\HttpKernel\HttpKernel->handle()
  ./public/index.php:70                              Symfony\Component\HttpKernel\Kernel->handle()
  Previous: DbUtils::getClassForItemtype(): Argument #1 ($itemtype) must be of type string, null given, called in ./src/DbUtils.php on line 549
  ./src/DbUtils.php:523                              
  ./src/DbUtils.php:549                              DbUtils->getClassForItemtype()
  ./src/autoload/dbutils-aliases.php:165             DbUtils->getItemForItemtype()
  ./src/Glpi/Search/Provider/SQLProvider.php:6737    getItemForItemtype()
  ./src/Glpi/Search/Provider/SQLProvider.php:5186    Glpi\Search\Provider\SQLProvider::giveItem()
  ./src/Glpi/Search/SearchEngine.php:655             Glpi\Search\Provider\SQLProvider::constructData()
  ./src/Glpi/Search/SearchEngine.php:670             Glpi\Search\SearchEngine::getData()
  ./src/Glpi/Search/SearchEngine.php:627             Glpi\Search\SearchEngine::showOutput()
  :                                                  Glpi\Search\SearchEngine::show()
  .../Application/View/Extension/PhpExtension.php:93 call_user_func_array()
  ...ates/87/8720b18a4db42e16e3ad3e58dc6ab1ae.php:55 Glpi\Application\View\Extension\PhpExtension->call()
  ./vendor/twig/twig/src/Template.php:402            __TwigTemplate_ab070da1fc3e5c9d0bd52448818f1268->doDisplay()
  ./vendor/twig/twig/src/Template.php:358            Twig\Template->yield()
  ./vendor/twig/twig/src/Template.php:373            Twig\Template->display()
  ./vendor/twig/twig/src/TemplateWrapper.php:51      Twig\Template->render()
  .../Glpi/Application/View/TemplateRenderer.php:170 Twig\TemplateWrapper->render()
  ./src/Glpi/Controller/AbstractController.php:68    Glpi\Application\View\TemplateRenderer->render()
  ./src/Glpi/Controller/GenericListController.php:51 Glpi\Controller\AbstractController->render()
  ./vendor/symfony/http-kernel/HttpKernel.php:181    Glpi\Controller\GenericListController->__invoke()
  ./vendor/symfony/http-kernel/HttpKernel.php:76     Symfony\Component\HttpKernel\HttpKernel->handleRaw()
  ./vendor/symfony/http-kernel/Kernel.php:197        Symfony\Component\HttpKernel\HttpKernel->handle()
  ./public/index.php:70                              Symfony\Component\HttpKernel\Kernel->handle()

fgendorf avatar Oct 02 '25 12:10 fgendorf

Hum i don't understand why you have that... have you a column linked to OCSInventory plugin ?

tsmr avatar Oct 02 '25 12:10 tsmr

Hi, yes, we use some fields like "Plugins - OCSNG - Inventory agent" and "Plugins - OCSNG - Last OCSNG connection date" in computers list

fgendorf avatar Oct 02 '25 13:10 fgendorf

Just confirmed, if I remove these columns from the list, the problem doesn't occur, not sure if it is a OCS Plugin problem or GLPI

fgendorf avatar Oct 02 '25 14:10 fgendorf

And if you add the columns again? no problem ?

tsmr avatar Oct 02 '25 15:10 tsmr

Yes, no problem if I add again. May be some missed on migration ?

fgendorf avatar Oct 02 '25 16:10 fgendorf