You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2020-07-29 18:13:04

Kaefer1303
Member
Registered: 2020-07-17
Posts: 5

Link between Computers and Softwares deleted when using Transfer List

Hi,
When I move one ore more computers to another entity (transfer list) I lose the connection between Software and all computers in my GLPI
To reconnect the Software I have to do an inventory of all computers.

If my research is correct, the table "glpi_items_softwareversions" is the link between software and computer!?
this table is empty after each computer transfer to another entity.

I installed a new testing GLPI 9.5.1 system and tried a few settings. The same thing happens there.

I have saved a mysql query logfile from the moment I click on "execute".
I can post it if required.

my System:
GLPI 9.5.1 with fusioninventory 9.5.0+1.0
Ubuntu Server 20.04 LTS
Apache 2.4.41
PHP 7.4.3
MariaDB 10.3.22

Offline

#2 2020-07-29 19:11:06

bacus99
Member
From: Montreal
Registered: 2008-08-21
Posts: 43

Re: Link between Computers and Softwares deleted when using Transfer List

Same issue

GLPI 9.5.1

DELETE `glpi_items_softwareversions` FROM `glpi_items_softwareversions` LEFT JOIN `glpi_networkequipments` ON (`glpi_items_softwareversions`.`items_id` = `glpi_networkequipments`.`id` AND `glpi_items_softwareversions`.`itemtype` = 'NetworkEquipment') WHERE `glpi_networkequipments`.`id` IS NULL
2020-07-29T11:56:06.427550-04:00        65270 Query     DELETE `glpi_items_softwareversions` FROM `glpi_items_softwareversions` LEFT JOIN `glpi_peripherals` ON (`glpi_items_softwareversions`.`items_id` = `glpi_peripherals`.`id` AND `glpi_items_softwareversions`.`itemtype` = 'Peripheral') WHERE `glpi_peripherals`.`id` IS NULL
2020-07-29T11:56:06.433614-04:00        65270 Query     DELETE `glpi_items_softwareversions` FROM `glpi_items_softwareversions` LEFT JOIN `glpi_phones` ON (`glpi_items_softwareversions`.`items_id` = `glpi_phones`.`id` AND `glpi_items_softwareversions`.`itemtype` = 'Phone') WHERE `glpi_phones`.`id` IS NULL
2020-07-29T11:56:06.439605-04:00        65270 Query     DELETE `glpi_items_softwareversions` FROM `glpi_items_softwareversions` LEFT JOIN `glpi_printers` ON (`glpi_items_softwareversions`.`items_id` = `glpi_printers`.`id` AND `glpi_items_softwareversions`.`itemtype` = 'Printer') WHERE `glpi_printers`.`id` IS NULL

Last edited by bacus99 (2020-07-29 19:12:41)

Offline

#3 2020-07-29 19:32:26

bacus99
Member
From: Montreal
Registered: 2008-08-21
Posts: 43

Re: Link between Computers and Softwares deleted when using Transfer List

Moved your question to GLPI eng general under my name, my setup is almost the same

Offline

#4 2020-07-29 20:31:10

bacus99
Member
From: Montreal
Registered: 2008-08-21
Posts: 43

Re: Link between Computers and Softwares deleted when using Transfer List

think it's somewhere here
         foreach ($CFG_GLPI['software_types'] as $itemtype) {
            $itemtable = getTableForItemType($itemtype);
            // Clean DB
            $DB->delete('glpi_items_softwareversions', ["{$itemtable}.id"  => null], [
               'LEFT JOIN' => [
                  $itemtable  => [
                     'ON' => [
                        'glpi_items_softwareversions' => 'items_id',
                        $itemtable                    => 'id', [
                           'AND' => [
                              'glpi_items_softwareversions.itemtype' => $itemtype
                           ]
                        ]
                     ]
                  ]
               ]
            ]);

            if (count($this->needtobe_transfer[$itemtype])) {
               $iterator = $DB->request([
                  'SELECT'       => [
                     'glpi_softwares.id',
                     'glpi_softwares.entities_id',
                     'glpi_softwares.is_recursive',
                     'glpi_softwareversions.id AS vID'
                  ],
                  'FROM'         => 'glpi_items_softwareversions',
                  'INNER JOIN'   => [
                     'glpi_softwareversions' => [
                        'ON' => [
                           'glpi_items_softwareversions' => 'softwareversions_id',
                           'glpi_softwareversions'       => 'id'
                        ]
                     ],
                     'glpi_softwares'        => [
                        'ON' => [
                           'glpi_softwareversions' => 'softwares_id',
                           'glpi_softwares'        => 'id'
                        ]
                     ]
                  ],
                  'WHERE'        => [
                     'glpi_items_softwareversions.items_id' => $this->needtobe_transfer[$itemtype],
                     'glpi_items_softwareversions.itemtype' => $itemtype
                  ]
               ]);

               if (count($iterator)) {
                  while ($data = $iterator->next()) {
                     if ($data['is_recursive']
                        && in_array($data['entities_id'], $to_entity_ancestors)) {
                        $this->addNotToBeTransfer('SoftwareVersion', $data['vID']);
                     } else {
                        $this->addToBeTransfer('SoftwareVersion', $data['vID']);
                     }
                  }
               }
            }
         }

Deleted from transfer.class.php, and no delete anymore

Offline

#5 2020-08-20 11:17:14

Kaefer1303
Member
Registered: 2020-07-17
Posts: 5

Re: Link between Computers and Softwares deleted when using Transfer List

This issue is now discussed on GitHub glpi-project #7864

Offline

#6 2020-09-18 09:45:24

Kaefer1303
Member
Registered: 2020-07-17
Posts: 5

Re: Link between Computers and Softwares deleted when using Transfer List

Fix #7967 on GitHub did solve the Problem for me.
I assume the Problem will be fixed in 9.5.2 since it is on the Milestones list.

Last edited by Kaefer1303 (2020-09-18 09:47:32)

Offline

Board footer

Powered by FluxBB