Bug 27444

Summary: Allow reports to count open/closed days based on the calendar
Product: Koha Reporter: Andrew Fuerste-Henry <andrew>
Component: ReportsAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Andrew Fuerste-Henry 2021-01-15 18:39:27 UTC
When writing reports related to fines or overdue notices, one runs into difficulties based on how Koha holidays are stored. There's no good way for SQL to calculate out how many days within a given span were open days. So if you're using the calendar to calculate when to send overdue notices at 10 open days past the due date, there's no way to get SQL to tell you which items should have gotten an overdue notice today.

This becomes more of an issue as we use the patron emailer more, since the patron emailer relies upon a report. If one wanted to use the patron emailer to send a fourth overdue notice, one would not be able to calculate when to send that notice using the Koha calendar.

I'm not sure what the solution is here. Maybe some syntax one could use in a report to ask Koha to generate a value? So you could say something like:

WHERE timestampdiff(days,date_due,curdate()) = <<opendays:date_due,curdate()>>
?