Bug 39145

Summary: Differentiate between deleting or transferring public and shared lists
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: ListsAssignee: Marcel de Rooy <m.de.rooy>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: aleisha, david, jake.deery, m.de.rooy, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Small patch Documentation contact:
Documentation submission: Text to go in the release notes:
This enhancement to the lists feature adds a new option to the ListOwnershipUponPatronDeletion system preference - "change owner of public lists, delete shared lists". When the patron that created a list is deleted (and this option is set): - the owner of any public lists are changed (to the patron deleting the patron, or the patron set in ListOwnerDesignated), and - any shared lists are deleted.
Version(s) released in:
Circulation function:
Attachments: Bug 39145: Add option to transfer only public lists to preference
Bug 39145: Apply new pref values to ->disown_or_delete
Bug 39145: Add unit tests
Bug 39145: (follow-up) Tidy files
Bug 39145: Add option to transfer only public lists to preference
Bug 39145: Apply new pref values to ->disown_or_delete
Bug 39145: Add unit tests
Bug 39145: (follow-up) Tidy files

Description Marcel de Rooy 2025-02-17 10:08:25 UTC
The pref ListOwnershipUponPatronDeletion currently only has two flavors:
- change owner of public or shared lists
- delete these lists

It would be nice to at least have a third option to change the owner of public lists only and delete the shared lists.
This would not add the burden to staff to take care of lists that were shared between some patrons.

The option to change owner for shared lists only seems to be less useful.
Comment 1 Marcel de Rooy 2025-02-17 12:21:24 UTC Comment hidden (obsolete)
Comment 2 Marcel de Rooy 2025-02-17 12:21:26 UTC Comment hidden (obsolete)
Comment 3 Marcel de Rooy 2025-02-17 12:21:28 UTC Comment hidden (obsolete)
Comment 4 Marcel de Rooy 2025-05-30 06:28:26 UTC Comment hidden (obsolete)
Comment 5 David Nind 2025-05-31 03:15:44 UTC
Created attachment 182870 [details] [review]
Bug 39145: Add option to transfer only public lists to preference

Test plan:
Run updatedatabase.pl
Check ListOwnershipUponPatronDeletion on Patron preferences tab.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Comment 6 David Nind 2025-05-31 03:15:47 UTC
Created attachment 182871 [details] [review]
Bug 39145: Apply new pref values to ->disown_or_delete

Test plan:
Set ListOwnershipUponPatronDeletion to 'change owner of
these lists'.
Create a public list1 and a private list2 for patron A.
Enable sharing lists and share list2 with another patron.
Remove patron A.
Check that list1 and list2 are transferred.
Set  ListOwnershipUponPatronDeletion to 'change owner of
public lists, delete shared lists'.
Create a public list3 and a private list4 for patron B.
Share list4 with another patron.
Remove patron B.
Check that list3 is transferred and list4 is deleted.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Comment 7 David Nind 2025-05-31 03:15:50 UTC
Created attachment 182872 [details] [review]
Bug 39145: Add unit tests

Test plan:
Run t/db_dependent/Koha/Virtualshelves.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2025-05-31 03:15:52 UTC
Created attachment 182873 [details] [review]
Bug 39145: (follow-up) Tidy files

No test plan (just result of perltidy).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Comment 9 David Nind 2025-05-31 03:26:07 UTC
Testing notes (using KTD):

1. I used Mary Burton as Patron A, Lisa Charles as Patron B, and Henry A as Patron C.

2. I edited each patron so that I could:
   - log in as that patron in the OPAC
   - share lists by adding an email address: added name@example.com as the email

3. To share lists, you need to enable this system preferences:
   - OpacAllowSharingPrivateLists - set to Allow

4. How to share a list:
   - Log in as Patron A (Mary)
   - Under Lists, select share and then share with Patron B (Lisa), email address is lisa@example.com
   - To "activate" the shared list:
     . access the database: koha-mysql kohadev
     . copy the URL from the email to Patron B (Lisa) to activate the shared list: 
        . select * from message_queue;
        . copy the URL from the message
     . login as Patron B in a private browser window (you need to log in as the patron before pasting the link)
     . paste the URL
     . accept the shared list
    
5. When you delete Patron A (Mary) the lists are transferred to the koha patron

6. When you delete Patron B (Lisa) the public list (list3) is transferred to the koha patron, and the private list (list4) is deleted
Comment 10 Marcel de Rooy 2025-06-02 07:25:16 UTC
(In reply to David Nind from comment #8)
> Signed-off-by: David Nind <david@davidnind.com>

Thx David !