[Koha-bugs] [Bug 24483] When batch deleting patrons, report who was not deleted and why

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Apr 16 14:30:22 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24483

--- Comment #2 from Andrew Fuerste-Henry <andrew at bywatersolutions.com> ---
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

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list