Skip to content

error SQL #205

Description

@inext68

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

GLPI Version

GLPI 11.0.08

Plugin version

2.10.3

Bug description

I receive this error

`MySQL` query error: Unknown column 'itemtype' in 'WHERE' (1054) in SQL query "SELECT `glpi_assets_assets_peripheralassets`.`id` FROM `glpi_assets_assets_peripheralassets` WHERE `itemtype` = 'Monitor' AND `items_id` = '1344'".
In ./src/DBmysql.php(416)
#0 ./src/DBmysqlIterator.php(129): DBmysql->doQuery()
#1 ./src/DBmysql.php(1088): DBmysqlIterator->execute()
#2 ./src/CommonDBTM.php(4679): DBmysql->request()
#3 ./plugins/uninstall/inc/uninstall.class.php(167): CommonDBTM->deleteByCriteria()
#4 ./plugins/uninstall/inc/uninstall.class.php(378): PluginUninstallUninstall::doOneUninstall()
#5 ./plugins/uninstall/front/action.php(79): PluginUninstallUninstall::uninstall()
#6 ./src/Glpi/Controller/LegacyFileLoadController.php(64): require('...')
#7 ./vendor/symfony/http-kernel/HttpKernel.php(181): Glpi\Controller\LegacyFileLoadController->__invoke()
#8 ./vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#9 ./vendor/symfony/http-kernel/Kernel.php(208): Symfony\Component\HttpKernel\HttpKernel->handle()
#10 ./public/index.php(71): Symfony\Component\HttpKernel\Kernel->handle()
#11 {main}

Found the probem on uninstall.class.php at line 167

        //--------------------//
        //Direct connections //
        //------------------//
        if (in_array($type, $UNINSTALL_DIRECT_CONNECTIONS_TYPE)) {
            $conn = new Asset_PeripheralAsset();
            $conn->deleteByCriteria(['itemtype_asset' => $type,
                'items_id_asset' => $id,
            ], true);
        }

and solved with this change:


        //--------------------//
        //Direct connections //
        //------------------//
        if (in_array($type, $UNINSTALL_DIRECT_CONNECTIONS_TYPE)) {
            $conn = new Asset_PeripheralAsset();
            $conn->deleteByCriteria(['itemtype_asset' => $type,
                'items_id_asset' => $id,
            ], true);
        }

Relevant log output

Page URL

No response

Steps To reproduce

No response

Your GLPI setup information

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions