Updated: Comment #1

Problem/Motivation

This is primarily an issue when importing Calendar views. If you export a calendar view the style option groupby_times is not normally exported, unless the database value is overriding the default value defined in the calendar style plugin. When the view is subsequently imported (often via a Feature) the groupby_times option is not initially stored in the database. The existing calendar code attempts to use the database value for groupby_times, which then triggers error messages such as:

For a day view:

Notice: Undefined index: groupby_times in template_preprocess_calendar_day() (line 267 of /foo/sites/all/modules/calendar/theme/theme.inc).
Notice: Undefined index: groupby_times in template_preprocess_calendar_day() (line 271 of /foo/sites/all/modules/calendar/theme/theme.inc).

For a week view:

Notice: Undefined index: groupby_times in template_preprocess_calendar_week() (line 480 of /foo/sites/all/modules/calendar/theme/theme.inc).
Notice: Undefined index: groupby_times in template_preprocess_calendar_week() (line 484 of /foo/sites/all/modules/calendar/theme/theme.inc).

Proposed resolution

There are have been various resolutions proposed to address this issue. For those without the permissions or knowledge to apply a patch you can force the groupby_times option to be stored in the database by editing the view and the day and week display and saving without changing any of the settings (see these instructions). An alternative is to edit the exported view configuration and and manually insert the option. However, the ideal resolution is to fix the code and this was discussed in #1397986: Errors at the day View: Undefined index: groupby_times in template_preprocess_calendar_day()...

Remaining tasks

Review patch below.

User interface changes

None.

API changes

None.

Files: 
CommentFileSizeAuthor
#1 calendar-groupby-times-2160183-1.patch2.24 KBeft

Comments

eft’s picture

Issue summary:View changes
Status:Needs work» Needs review
StatusFileSize
new2.24 KB

The attached patch attempts to resolve this issue for new and existing sites. Many thanks to FatGuyLaughing, jbylsma, dhalbert and KarenS for their work to date on this issue.

eft’s picture

Issue summary:View changes
PascalAnimateur’s picture

The patch works perfectly on my setup. You get my vote for a commit!

silurius’s picture

Edit: Oops, wrong issue, nothing to see here...

guillaumev’s picture

Status:Needs review» Reviewed & tested by the community

Related issue: https://www.drupal.org/node/1895778.

In my case, this patch fixed both the user notice message AND the display of overlapping events in the week and day view... RTBC ?

miromarchi’s picture

+1 for Patch in #1, worked correctly! Thanks

Nemanja’s picture

Patch works for me +1

milovan’s picture

Patch works here as well, thanks. Will you include it in next release, please?

ladybug_3777’s picture

Agreed, this patch works! Another vote to include it in the next release please!

dekisha’s picture

Patch worked for me also +1

michielkenis’s picture

Patch tested and confirmed :)

lsabug’s picture

This patch works for me as well. Will it be committed?

ademarco’s picture

Works for me too.