Bug 13534 - Deleting staff patron will delete tags approved by this patron
Summary: Deleting staff patron will delete tags approved by this patron
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 5334
  Show dependency treegraph
 
Reported: 2015-01-07 17:27 UTC by Katrin Fischer
Modified: 2017-06-14 22:05 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 13534: Do not remove tags on deleting a patron (3.59 KB, patch)
2016-01-13 14:45 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 13534: Do not remove tags on deleting a patron (3.65 KB, patch)
2016-01-14 00:55 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 13534: Do not remove tags on deleting a patron (3.69 KB, patch)
2016-01-15 16:47 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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 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.