Download & Extend

Office hours does not respect "First day of week" setting (grouped values formatter)

Project:Office Hours
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

In Drupal's date and time configuration (admin/settings/date-time), you can select what day of the week it's to be considered the first.

Office hours does currently not respect this setting, so when the field is displayed, Sunday is always listed first.

Comments

#1

Status:active» fixed

True, and i think this is a good idea. I've added this to today's snapshot.

#2

Status:fixed» closed (fixed)

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

#3

Status:closed (fixed)» active

I found this problem in 6.x-1.0.

Here is an easy fix:

On office_hours.theme.inc in the function "theme_office_hours_formatter_default"

Al line 29

change

if ($keys[0] != $days[$first] && in_array(t($days[$first]), $items) ) {

for

if ($keys[0] != $days[$first] && array_key_exists(t($days[$first]), $items) ) {

#4

Status:active» fixed

Thanks, committed to head

#5

Status:fixed» closed (fixed)

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

#6

Status:closed (fixed)» needs review

I had the same problem with grouped values.
Here's my fix:

In office_hours.theme.inc, changed

function _office_hours_set_group_label(&$group) {
  // reference days
  $group_days = &$group['days'];
  asort($group_days);

to
function _office_hours_set_group_label(&$group) {
  // reference days
  $group_days = &$group['days'];
  $first = variable_get('date_first_day',0);
  foreach ($group_days as $day_name => $day_num) {
    if ($day_num < $first) $group_days[$day_name]+= 7;
  }
  asort($group_days);

#7

Title:Office hours does not respect "First day of week" setting» Office hours does not respect "First day of week" setting (grouped values)

PS. group formatter is not supported in D7 (yet).

#8

Title:Office hours does not respect "First day of week" setting (grouped values)» Office hours does not respect "First day of week" setting (grouped values formatter)
nobody click here