Bug 41405

Summary: Patron categories noissuescharge values default to 0 when not set
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: PatronsAssignee: Nick Clemens (kidclamp) <nick>
Status: In Discussion --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: aude.charillon, caroline.cyr-la-rose, gmcharlt, katrin.fischer, kyle
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41404
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20338
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38704
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25219
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 41405: Treat blank value as unset

Description Nick Clemens (kidclamp) 2025-12-08 18:44:23 UTC
To recreate:
1 - In a new KTD, check the values for a category:
    SELECT * FROM categories WHERE categorycode ='B'\G
2 - By default these three columns are null:
                        noissuescharge: NULL
              noissueschargeguarantees: NULL
noissueschargeguarantorswithguarantees: NULL
3 - If they are not, set them so:
    UPDATE categories SET noissuescharge=NULL, noissueschargeguarantees=NULL, noissueschargeguarantorswithguarantees=NULL;
4 - Open the category in staff interface:
    More->Administration->Patron categories->Edit
5 - Note the three inputs are set to 0
    Checkout charge limit
    Guarantees checkout charge limit
    Guarantors with guarantees checkout charge limit
6 - Save the entry without making changes
7 - Check the DB as in Step 1
8 - Note all values are 0
9 - Edit and black the inputs and save
10 - Check the DB
11 - Note all value are now undef

We should not have to edit the form to prevent changes
Comment 1 Nick Clemens (kidclamp) 2025-12-08 18:57:51 UTC
Created attachment 190308 [details] [review]
Bug 41405: Treat blank value as unset
Comment 2 Nick Clemens (kidclamp) 2025-12-08 19:34:18 UTC
Maybe this is actually invalid?

The code that checks these in Koha::Patron::is_patron_inside_charge_limit uses:

3512     my $no_issues_charge = $patron_category->noissuescharge || C4::Context->preference('noissuescharge');
3513     my $no_issues_charge_guarantees =
3514         $patron_category->noissueschargeguarantees || C4::Context->preference('NoIssuesChargeGuarantees');
3515     my $no_issues_charge_guarantors_with_guarantees = $patron_category->noissueschargeguarantorswithguarantees
3516         || C4::Context->preference('NoIssuesChargeGuarantorsWithGuarantees');
3517 

So if they are 0 they don't matter?

I don't think it is supposed to work this way though - based on 41404 and the way NoIssuesCharge seems to work a 'blank' is "There is no limit" and Zero should be "Any fines should block issues"