Download & Extend

Validate hours not behaving correctly

Project:Office Hours
Version:5.x-1.3
Component:User interface
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

In the office hours field settings within the CCK content type administration, there is a parameter to set if hours will be validated.

"Validate hours:
[checkbox] Check that closing hours are not earlier than opening hours"

There are two problems:
1. The checkbox is not checked by default, but yet the module seems to validate my data and always tells me that I am not allowed to set a closing hour lower than an opening hour.
2. If I click the checkbox and submit the configuration page, and then return to it - the box is always unchecked. There is a problem with the submit.

Maybe both errors are connected, but I need to be able to specify a closing hour that is less than an opening hour for a scenario where the closing hours are in the middle of the night.

Hope someone can resolve.

Tks, Jayson

Comments

#1

Hi Jayson,
Thanks for the report, i'll corrent this and hopefully relase it soon.

#2

Awesome, thanks! It's a great module. I'm waiting on your fix before I go live.

#3

Please try the new dev version i commited, it's supposed to fix this issue.
If testing confirms everything's ok, i'll add it as an official release.

#4

Ozeuss, thank you for the update, I installed it and tested it out.

Unfortunately, I don't think the validate hours feature is working as I need it to yet. Basically, I want to use the field to have office hours of 9am to 2am in some cases (e.g. a restaurant/pub opens in the morning for breakfast but stays open late for the pub atmosphere and always closes at 2am). Right now, there is no way for me to use this module for these situations.

So, here is what I did for testing the new dev version: I unchecked the box for "Validate Hours" and saved the content field. Then I edited my node and set a field of opening hours to be open: 0900, and close: 0200. I continue to get the error "Closing hours are earlier than opening hours". I was under the impression that if I removed the "validate hours" checkbox, that I would then be able to enter data where the closing time can be less than the opening time.

I also noticed that you changed the description from: "Check that closing hours are not earlier than opening hours", to: "Please note that this will work as long as the opening hours are not through midnight. I'm note sure how to interpret the new description. What other validation is done other than checking if the closing hours are not earlier than the opening hours?

#5

I've made a small change- and now it's supposed to work. Usually dev files update every 12 hours, so I'll attach a patch if anyone wants to view/pathc it until then.
I also changed the wording so it now contains both sentences you mention in the post (as it should have).
So basically, now it seems to work as expected and written- if the box is not checked, there is no validation of opening vs closed hrs. If it is checked, it validates that opening hours are indeed earlier. For the situation you described (pubs, restaurants opening late) there is of course no way to validate, and the box should be unchecked.

AttachmentSize
validate.patch 1.34 KB

#6

Excellent - removing the validate hours checkbox now allows me to input closing hours that are less than opening hours! Thank you for the quick resolution.

There's a couple of typos in the office_hours field configuration page that I noticed and thought I should just inform you of. Basically a couple of 0's appear at the end of the help text for the limit widget hours fields, I've copy and pasted from the page:

Limit widget start hours:
Set the allowed start hours. Note: if you just changed the clock format, please submit before changing this.0
Limit widget end hours:
Set the allowed end hours. Note: if you just changed the clock format, please submit before changing this0

That's all - awesome module!

#7

Status:active» closed (won't fix)

Closing this. D5 is not maintained anymore.