-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Management of duplicate documents during entity transfer #22389
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
base: 11.0/bugfixes
Are you sure you want to change the base?
Management of duplicate documents during entity transfer #22389
Conversation
|
Please add tests. Similar errors also happen on other itemtypes; see #20256 (documents and softwareversion so far). Fix is maybe the same. |
tests/functional/TransferTest.php
Outdated
| ]); | ||
| $this->assertGreaterThan(0, $ticket_source_id); | ||
|
|
||
| // Link the SAME document to the source ticket |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that was what I missed when I take a look at similar issue ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests do not seem to execute the code you modified.
|
@AdrienClairembault, the E2E tests that are failing do not seem to be related to this PR. Could you please confirm? |
Yes, I confirm 👍 |
Checklist before requesting a review
Please delete options that are not relevant.
Description
When transferring a ticket to another entity, if a document is already linked to the same object in the destination entity, a SQL duplicate error occurs.
This error is caused by the unique constraint on the glpi_documents_items table, applied to the columns (documents_id, itemtype, items_id, timeline_position).
Modification of the transferDocuments method in Transfer.php.
Before each UPDATE: check whether the target relationship already exists :
Before each INSERT: check whether the relationship already exists :