Bug 36360

Summary: Link ILL requests to surviving patron record when patrons are merged
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: PatronsAssignee: Pedro Amorim <pedro.amorim>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrew.auld, clemens.tubach, gmcharlt, kyle, martin.renvoize, michaela.sieber, pedro.amorim, richard.bridgen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32630
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 36360: Add Illrequest to list of stuff to consider merging
Bug 36360: Add tests
Bug 36360: Add Illrequest to list of stuff to consider merging
Bug 36360: Add tests

Description Katrin Fischer 2024-03-19 16:31:43 UTC
When patrons are merged, the ILL requests of the deleted patron records are deleted as well. They should be re-linked to the remaining/winning patron record instead.
Comment 1 Pedro Amorim 2025-10-16 10:26:47 UTC
Created attachment 187984 [details] [review]
Bug 36360: Add Illrequest to list of stuff to consider merging
Comment 2 Pedro Amorim 2025-10-16 10:26:50 UTC
Created attachment 187985 [details] [review]
Bug 36360: Add tests

prove t/db_dependent/Koha/Patrons.t

Test plan, k-t-d:
1) Enable ILLModule
2) Create an ILL request for patron 'John', visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard
3) Type 'John' and pick the only result. Set a type and library. Click 'Create'.
4) Go to patrons search and search for 'jo':
<staff_url>/cgi-bin/koha/members/members-home.pl
5) Tick the checkbox for John and someone else from the list. Click 'Merge selected patrons' from the top toolbar
6) Select the other patron (not John) as the 'patron to keep'. Click Merge patrons.
7) Notice '1 Illrequest was merge' message shows.
8) Visit the ILL list table, visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl
9) Notice the ILL request now belongs to the other patron, not John (who no longer exists).
Comment 3 OpenFifth Sandboxes 2025-11-25 12:35:01 UTC
Created attachment 189922 [details] [review]
Bug 36360: Add Illrequest to list of stuff to consider merging

Signed-off-by: Richard Bridgen <richard.bridgen@nhs.net>
Comment 4 OpenFifth Sandboxes 2025-11-25 12:35:03 UTC
Created attachment 189923 [details] [review]
Bug 36360: Add tests

prove t/db_dependent/Koha/Patrons.t

Test plan, k-t-d:
1) Enable ILLModule
2) Create an ILL request for patron 'John', visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard
3) Type 'John' and pick the only result. Set a type and library. Click 'Create'.
4) Go to patrons search and search for 'jo':
<staff_url>/cgi-bin/koha/members/members-home.pl
5) Tick the checkbox for John and someone else from the list. Click 'Merge selected patrons' from the top toolbar
6) Select the other patron (not John) as the 'patron to keep'. Click Merge patrons.
7) Notice '1 Illrequest was merge' message shows.
8) Visit the ILL list table, visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl
9) Notice the ILL request now belongs to the other patron, not John (who no longer exists).

Signed-off-by: Richard Bridgen <richard.bridgen@nhs.net>