Bug 37936

Summary: Misleading message about AnonymousPatron in batch anonymization tool
Product: Koha Reporter: Caroline Cyr La Rose <caroline.cyr-la-rose>
Component: ToolsAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: david
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Caroline Cyr La Rose 2024-09-16 21:01:09 UTC
If using the default data (AnonymousPatron = 0), the batch anonymization tool states "The AnonymousPatron system preference is not defined. You can use this feature anyway but NULL will be used to update the checkout history."

However, if you try to anonymize checkout histories, you get an error message saying (among other things) "Exception 'Koha::Exceptions::SysPref::NotSet' thrown 'Required syspref is not set' with syspref => AnonymousPatron"

To recreate:
1. Make sure the AnonymousPatron system preference is set to 0 (the default value)
2. Check out an item to a patron and check it back in
3. Go to Tools > Batch patron deletion and anonymization
   --> In the Batch anonymization section, note that it says that the preference 
       is not set, but we can still use the tool.
4. Check the box Verify you want to anonymize patron checkout history
5. Set the date to tomorrow
6. Click Next
7. Click Finish
   --> Trace error

Either we need to change the message and/or disable the tool if the AnonymousPatron system preference is 0 or empty, or we need to do as the message says and use NULL instead.
Comment 1 David Nind 2024-09-16 21:06:25 UTC
The error is also generated if you have OPACPrivacy set to 'Allow'. 

To replicate:
1. Set OPACPrivacy to 'Allow'
2. In the OPAC go to Your account > Privacy
3. Attempt to set the "Please choose your privacy rule" to 'Never'
4. You get an error:

Exception 'Koha::Exceptions::SysPref::NotSet' thrown 'Required syspref is not set' with syspref => AnonymousPatron
 at /usr/share/perl5/Exception/Class/Base.pm line 88
in Exception::Class::Base::throw at /usr/share/perl5/Exception/Class/Base.pm line
...