Bug 36596

Summary: Opening/closing hours should be forced to be set together
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: Architecture, internals, and plumbingAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: martin.renvoize, tomascohen
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:
Bug Depends on: 6796    
Bug Blocks:    

Description Tomás Cohen Arazi (tcohen) 2024-04-12 12:11:35 UTC
It only seems to make sense to set a closing hour if an opening hour has been set, otherwise it would be open 24 hs :-D

A method needs to be added to Koha::Library:

* set_hours( $dow, $opening, $closing )
* The method needs to throw an exception if one of them is not passed
* If none is passed then it means the library would not be open, and then all hours for the 
* The code for setting the hours in branches.pl should be removed and this method used instead
* The method MUST BE COVERED BY TESTS


NOTE: I don't personally like the chosen column name 'day'. I would use either 'dow' or 'day_of_week'. And it should be clear which one is the first in the comments.
Comment 1 Martin Renvoize (ashimema) 2024-04-15 17:25:32 UTC
Whilst I agree about the column name and the requirement to set both openening and closing.. I'm not so sure about the meaning of no opening/closing.. that could just mean it's a 24h library and open the whole day rather than having an opening/closing time right?
Comment 2 Martin Renvoize (ashimema) 2024-04-15 17:36:20 UTC
We're back into naming consistency territory here.. in repeatable_holidays it's:

> `weekday` smallint(6) DEFAULT NULL COMMENT 'day of the week (0=Sunday, 1=Monday, etc) this closing is repeated on'
Comment 3 Martin Renvoize (ashimema) 2024-08-22 10:57:31 UTC
What about 24h libraries.. in those cases you'll want to open one day and close another so you wouldn't necessarily want to be forced to put both opening and closing times in at the same input.