Bug 32398

Summary: Patron import may partially delete restrictions
Product: Koha Reporter: Andrew Fuerste-Henry <andrewfh>
Component: ToolsAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31095
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:

Description Andrew Fuerste-Henry 2022-12-02 19:22:59 UTC
To recreate:
1 - have a patron, put a manual restriction on their account
2 - create a CSV for patron import that matches your patron
3 - add the debarred and debarredcomment columns to your CSV, but don't put any values into them for your test patron
4 - import your file, matching your patron, and overwriting the existing patron with the new data
5 - reload your patron's record
6 - confirm your patron is allowed to check out but that the Restrictions tab still lists the restriction created in step 1

The patron import nulls out borrowers.debarred and borrowers.debarredcomment but does not update the borrower_debarments table. This leaves the patron with a zombie debarment that doesn't get enforced.

I'm not entirely sure what the right answer here is. Either we should not allow patron imports to delete debarments at all or we should make sure it does the deletion properly and completely.

For comparison, if one uses batch patron modification to clear the debarred and debarredcomment fields, Koha deletes ALL debarments on that account.
Comment 1 Katrin Fischer 2022-12-04 13:00:26 UTC
I think we should not allow to undebar with the patron import or have a more solid way to indicate it than leaving columns empty. Like indicating the restriction codes that you want to lift.

There can be multiple restrictions added for very different reasons, not only one, I think that's the main issue.

So I think empty columns should just be ignored on import.