Bug 13534

Summary: Deleting staff patron will delete tags approved by this patron
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: OPACAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: brendan, f.demians, jonathan.druart, julian.maurice, nengard, rgravel
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 5334    
Attachments: Bug 13534: Do not remove tags on deleting a patron
Bug 13534: Do not remove tags on deleting a patron
Bug 13534: Do not remove tags on deleting a patron

Description Katrin Fischer 2015-01-07 17:27:10 UTC
I am trying to wrap my mind around the table structure, but what happens is:

If you add a tag, it will be in tags_all and tags_approval.

tags_approval has a column approved_by, that is linked to the staff patron who moderated the tag. 

If the staff patron is deleted, the entry in tags_approval is also deleted, but tags_all remains.

The tag vanishes from the tag moderation tool and from the OPAC.

http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=installer/data/mysql/kohastructure.sql;hb=b4e843615a76d3a9a8516f82a2ebad96aa9c4d1a#l2268

This doesn't feel like intended behaviour. 

I think it maybe it would make sense to set the borrowernumber to NULL when the staff patron is deleted.
Comment 1 rgravel 2015-03-25 12:42:32 UTC
Unfortunately I have no solution to offer on this, however, I wanted to chime in and remark on how problematic this is for our library in the hope that it will spark some movement on this! We lost *hundreds* of tags when two staff member patron accounts were deleted, resulting in a labor-intensive project to identify the lost tags and to re-tag things. I would love to see a solution that preserves those tags after folks move on. Thank you!
Comment 2 Jonathan Druart 2016-01-13 14:45:17 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2016-01-13 14:46:29 UTC
Increasing severity since it can cause data lost.
Comment 4 Aleisha Amohia 2016-01-14 00:55:16 UTC Comment hidden (obsolete)
Comment 5 Kyle M Hall (khall) 2016-01-15 16:47:35 UTC
Created attachment 46713 [details] [review]
Bug 13534: Do not remove tags on deleting a patron

On deleting a patron, all the tags approved by this user will be
deleted.
This can cause data lost.

Test plan:
0/ Do not execute the update DB entry
1/ Create 2 patrons A, B
2/ Create some tags with patron A logged in
3/ Approve them with patron B logged in
4/ Delete the 2 patrons
=> The tags have been deleted
5/ Execute the DB entry
6/ Repeat 1,2,3,4
=> The tags have not been deleted and are still shown on the interface
(result, detail, tags module)

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Brendan Gallagher 2016-02-23 15:35:31 UTC
Pushed to Master - Should be in the May 2016 Release.  Thanks!
Comment 7 Julian Maurice 2016-02-26 10:18:41 UTC
Patches pushed to 3.22.x, will be in 3.22.4
Comment 8 Frédéric Demians 2016-03-01 15:24:05 UTC
This patch has been pushed to 3.20.x, will be in 3.20.9.