Bug 24483 - When batch deleting patrons, report who was not deleted and why
Summary: When batch deleting patrons, report who was not deleted and why
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
: 21292 (view as bug list)
Depends on: 14708
Blocks:
  Show dependency treegraph
 
Reported: 2020-01-22 14:36 UTC by Andrew Fuerste-Henry
Modified: 2020-11-05 14:03 UTC (History)
6 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2020-01-22 14:36:44 UTC
When using the batch patron deletion tool, patrons are not deleted if:
- They have current checkouts
- They have a non-zero balance
- They are the guarantor to another patron
- They are of a patron category of type staff

But Koha never specifically tells the user which borrowers out of their defined pool for deletion are not deleted or why.

To test:
- Create a patron list
- Add to that list one patron for each of these conditions:
-- one patron with an item checked out
-- one patron with a non-zero balance
-- one patron who is a guarantor
-- one patron in a staff category
-- one patron not meeting any of the conditions above
- Go to batch patron deletion, attempt to delete all patrons on your list
- Koha tells you 1 patron will be deleted

Ideally, Koha would give a list of which patrons will not be deleted and why.
Comment 1 Andrew Fuerste-Henry 2020-04-16 12:03:31 UTC
Noting that bug 14708 would add another constraint and prevent the deletion of the AnonymousPatron.
Comment 2 Andrew Fuerste-Henry 2020-04-16 12:30:22 UTC
In the meantime, I wrote a report to tell you who isn't going to get deleted:
SELECT cardnumber, surname, firstname, if(sum(amountoutstanding)=0,null,sum(amountoutstanding)) as account_balance, if(count(issues.issue_id)=0,null,count(issues.issue_id)) as current_checkouts, guarantees, if(category_type='S','Staff',null) as is_staff
FROM borrowers left join accountlines using (borrowernumber) left join issues using (borrowernumber) left join categories using (categorycode) left join 
(SELECT guarantorid, group_concat(concat(firstname,' ',surname,' ',cardnumber)) as guarantees from borrowers where guarantorid is not null group by guarantorid) g on (borrowers.borrowernumber=g.guarantorid)
WHERE [plug in how you're defining your deletion -- could be categorycode, patron list, etc]
GROUP BY borrowernumber
HAVING account_balance is not null OR current_checkouts is not null OR guarantees is not null OR is_staff is not null
Comment 3 Caroline Cyr La Rose 2020-07-20 14:18:25 UTC
*** Bug 21292 has been marked as a duplicate of this bug. ***
Comment 4 Jonathan Druart 2020-11-05 14:03:48 UTC
I would suggest to implement bug 26170 first.