Bug 40961 - LocalUse Circulation Statistics offering empty results
Summary: LocalUse Circulation Statistics offering empty results
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: 25.05
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-06 17:20 UTC by Todd Goatley
Modified: 2025-10-06 18:40 UTC (History)
3 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 40961: Fix query for localuse (2.03 KB, patch)
2025-10-06 18:19 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Todd Goatley 2025-10-06 17:20:17 UTC
Libraries are reporting that the LocalUse Circulation Statistics offer empty results once setup and then ran. The other selections return results.
Comment 1 Lucas Gass (lukeg) 2025-10-06 17:28:29 UTC
To recreate:

1. Set RecordLocalUseOnReturn to 'Record'
2. Record some local uses by checking in items 
3. You can double check the DB that local uses are getting record with: select localuse from items where itemnumber = ITEMNUMBER;
4. Go to reports > Statistics wizards -> Circulation 
5. Adjust "Type:" to "Local use"
6. Notice there are 0 results
Comment 2 Lucas Gass (lukeg) 2025-10-06 18:19:58 UTC
Created attachment 187489 [details] [review]
Bug 40961: Fix query for localuse
Comment 3 Lucas Gass (lukeg) 2025-10-06 18:21:23 UTC
Very unsure about this patch. It skips looking for items.homebranch or borrowers.branchcode if local use is selected, because those values can be NULL.
Comment 4 Andrew Fuerste-Henry 2025-10-06 18:39:00 UTC
This is sort of a weird issue. 
If one records local use via checkin with the RecordLocalUseOnReturn syspref, those localuse entries will always lack a borrowernumber and therefor have a NULL for patron's home library. That means they won't come up in any query made via the wizard that selects a value for patron's home library.
But if one records local use via a statistical patron, then there will be an associated borrowernumber and therefore a patron home library and folks may want to filter their results based on that value.

Prior to Bug 20601, the patron library dropdown in the wizard didn't work and therefore didn't impact these queries.
Comment 5 Andrew Fuerste-Henry 2025-10-06 18:40:30 UTC
Expanding on that comment: the current behavior is technically correct but confusing to the user.