Related commit - 67655c01ce
ported code from 6.x fix (issue #1044594: Limit widget hours: setting not saving )

Comments

Ozeuss’s picture

StatusFileSize
new2.23 KB

Bug reported by @Lazarus-Long - conflict with valhrs with related commit.
I adapted the patch from a closed issue - attached. will be committed to dev shortly.

Lazarus-Long’s picture

Patch did not resolve the issue. #valhrs is being included but is not checked in _office_hours_select_process()

johnv’s picture

Status: Active » Fixed

It was not clear to me, but this was fixed..

johnv’s picture

Status: Fixed » Needs work

...but not yet correct according to #2.

johnv’s picture

Status: Needs work » Fixed

Committed in 479fd13

PS1: This was the cause of #1606744: No values on node edit page.
PS2: The remarks in #1044594-6: Limit widget hours: setting not saving for D6 are also valid for D7.

johnv’s picture

Status: Fixed » Needs work
StatusFileSize
new21.75 KB
new63.84 KB

There is an error with 'more hours', when being set to '00'.
See attached screendumps, where the value of 'more hours' used to be empty, now '00-00'.
It causes undesired effects on the formatter.
See the last line of screendump 1 and the widget of screendump 2.

Ozeuss’s picture

Status: Needs work » Needs review
StatusFileSize
new2.36 KB

Change logic a bit - limit hours and valhrs are different, and either limit can be set.
It seems ok now (more hours are not set to '00') - comments?

johnv’s picture

Lazarus-Long’s picture

This again ignores the valhrs setting. Even if one or both limits are set, if the valhrs checkbox isn't checked, the limits need to be ignored.

I've moved the limiting logic to _office_hours_limit_hours(), and allowed it to accept just a start or end time, rather than requiring both. We can still require the settings to set both, but this will accommodate any current settings sites may have.

I've also commented out the limiting logic in _office_hours_field_validate() as the values should already be validated by the FAPI. There may be an issue with less-than-an-hour limits though, but those don't seem to be detected by the current logic anyway.

This will probably be the last I work on this as I plan on making a new widget, as described in #1613110: New widget.

johnv’s picture

Regarding this line:

-  if (!empty($element['#valhrs']) && !empty($element['#limitend']) ) {
+  if (!empty($element['#limitstart']) || !empty($element['#limitend']) ) {

Is limiting the hours part of 'validate hours' (i.e. works only if 'validate' is set), or a separate functionality?

[EDIT] I'll just make it explicit by changing the helptext: "Assures that endhours are later then starthours. Please note that this will work as long as the opening hours are not through midnight."

johnv’s picture

Status: Needs review » Fixed

OK, thanks, this works.
Added some Coder-changes and committed #7 to 28953ba

johnv’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Fixed » Patch (to be ported)

both this and 479fd13 need backporting to D6.

Ozeuss’s picture

Johnv,
Yes - they are completely separate. valhrs does exactly what you described.
'limit hours' is just for making the widget more 'friendly' by making them compact (since, for example, libraries don't usually need the hours till 7-8am). because of this I wondered if we needed to go through the hassle of validating the limit hours at all. I ended up including it.

thanks for the commit.

johnv’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Patch (to be ported) » Fixed

I don't think will will backport this anymore.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.