Bug 15023 - Allow patron anonymize/bulk delete tool to be limited by branch
Summary: Allow patron anonymize/bulk delete tool to be limited by branch
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-16 12:20 UTC by Kyle M Hall
Modified: 2017-06-14 22:16 UTC (History)
6 users (show)

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


Attachments
Bug 15023: Allow patron anonymize/bulk delete tool to be limited by branch (8.03 KB, patch)
2016-06-27 15:26 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 15023: (followup) Remove warnings (959 bytes, patch)
2016-06-27 15:26 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 15023: Allow patron anonymize/bulk delete tool to be limited by branch (8.08 KB, patch)
2016-07-18 03:58 UTC, Liz Rea
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 15023: (followup) Remove warnings (1017 bytes, patch)
2016-07-18 04:00 UTC, Liz Rea
Details | Diff | Splinter Review
[PASSED QA] Bug 15023: Allow patron anonymize/bulk delete tool to be limited by branch (8.14 KB, patch)
2016-07-26 19:43 UTC, Katrin Fischer
Details | Diff | Splinter Review
[PASSED QA] Bug 15023: (followup) Remove warnings (1.05 KB, patch)
2016-07-26 19:45 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall 2015-10-16 12:20:35 UTC
It has been requested that the anonymization tool be allowed to work on patrons for an individual branch rather than being all or nothing as it is now.
Comment 1 Tomás Cohen Arazi 2016-06-27 15:26:18 UTC Comment hidden (obsolete)
Comment 2 Tomás Cohen Arazi 2016-06-27 15:26:24 UTC Comment hidden (obsolete)
Comment 3 Liz Rea 2016-07-18 03:58:29 UTC Comment hidden (obsolete)
Comment 4 Liz Rea 2016-07-18 04:00:41 UTC Comment hidden (obsolete)
Comment 5 Katrin Fischer 2016-07-26 06:25:27 UTC
My patron's homebranch is Midway. IndependentBranches is turned off.

I am trying to anonymize the checkout history older than yesterday for Springfield patrons. I have one entry in old_issues, where the patron is from Springfield. -> The tool reports: 0 patron's checkout histories will be anonymized.

When I choose Midway it reports it will delete the checkout histories of 5 people. When I check old_issues, there seem to be only 4 people with checkout histories to delete:

select count(distinct borrowernumber) from old_issues where borrowernumber in (select borrowernumber from borrowers where branchcode = "MPL")

Can you please check, what's going on here?
Comment 6 Katrin Fischer 2016-07-26 19:42:26 UTC
We found out: while deleting patrons works by the patron's homebranch, anonymizing uses the checkout branch. As this is the existing behaviour with independent branches turned on, the new behaviour is consistent. Maybe this could be added as a note to documentation.
Comment 7 Katrin Fischer 2016-07-26 19:43:24 UTC
Created attachment 53735 [details] [review]
[PASSED QA] Bug 15023: Allow patron anonymize/bulk delete tool to be limited by branch

This patch makes the bulk patron delete/anonymize functionality be limited
by branch. It does so by adding a branch selection dropdown and using the
already defined APIs for filtering by branch.

It makes use of C4::Branches::onlymine for the IndependentBranches use case
and it adds a way to call it from the Branches template plugin.

To test:
- Apply the patch
1) Have a superlibrarian user
- Go to Tools > Batch patron deletion/anonymization
=> SUCCESS: Verify you can pick a branch (or all of them)
- Try doing some operations
=> SUCCESS: Verify the selection is respected, and carried around all steps
2) Have a user with tools/delete_anonymize_patrons permissions
- Set IndependentBranches on
- Go to Tools > Batch patron deletion/anonymization
=> SUCCESS: It picks the librarian's branch and doesn't let us choose another one
- Try doing some operations
=> SUCCESS: Verify the user's branch is respected, and carried around all steps
- Sign off :-D

Sponsored-by: VOKAL
Signed-off-by: Liz Rea <liz@catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Katrin Fischer 2016-07-26 19:45:05 UTC
Created attachment 53736 [details] [review]
[PASSED QA] Bug 15023: (followup) Remove warnings

By setting 'use Modern::Perl' some previously hidden warnings arised.
This patch removes them by testing the variable $balance for undef
before using it in a comparisson.

Sponsored-by: VOKAL
Signed-off-by: Liz Rea <liz@catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Kyle M Hall 2016-08-24 11:37:40 UTC
Pushed to master for 16.11, thanks Tomas!