Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lost of items in transfer #5703

Conversation

cedric-anne
Copy link
Member

@cedric-anne cedric-anne commented Mar 28, 2019

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
  1. Fix conditions on deletion (see explaination above)
  2. Fix typo in table name
  3. Fix condition in search for documents to transfer
  4. Fix bad usage of key 'dtype' instead of $dtype

Explaination of point 1.

Looks like the base purpose of the code commented with // Clean DB in transfer class was to clean the lines that were not valid (i.e. having a foreign key pointing to a wrong element).

SELECT `glpi_documents_items`.`id`, `glpi_changes`.`id` FROM `glpi_documents_items` LEFT JOIN `glpi_changes` ON (`glpi_documents_items`.`items_id` = `glpi_changes`.`id` AND `glpi_documents_items`.`itemtype` = 'Change') WHERE `glpi_changes`.`id` IS NULL
will return a line with `glpi_changes`.`id` => NULL for all documents that are not linked to a Change.

SELECT `glpi_documents_items`.`id`, `glpi_changes`.`id` FROM `glpi_documents_items` LEFT JOIN `glpi_changes` ON (`glpi_documents_items`.`items_id` = `glpi_changes`.`id`) WHERE `glpi_changes`.`id` IS NULL AND `glpi_documents_items`.`itemtype` = 'Change'
will return a line with `glpi_changes`.`id` => NULL for all documents that are linked to Change itemtype but with an id that does not correspond to a change.

1. Fix conditions on deletion
2. Fix typo in table name
3. Fix condition in search for documents to transfer
4. Fix bad usage of key 'dtype' instead of $dtype
@cedric-anne cedric-anne self-assigned this Mar 28, 2019
@trasher trasher merged commit 97ed38f into glpi-project:9.4/bugfixes Apr 1, 2019
@cedric-anne cedric-anne deleted the 9.4/fix-lost-of-items-in-transfer branch April 1, 2019 07:13
@cedric-anne cedric-anne added this to the 9.4.2 milestone Apr 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants