With a mini-calendar month view (linking to a day view page) in a block, I'm getting this error shown:

Notice: Undefined offset: 3 in calendar_granularity_path() (line 526 of /path/to/calendar/calendar.module).

Attached patch fixes the problem for me.

Comments

artatac’s picture

Having just updated to the latest calendar and date dev - I am also getting

Notice: Undefined variable: type in calendar_granularity_path() (line 518 of D:\wamp\www\aclv2\sites\all\modules\calendar\calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of D:\wamp\www\aclv2\sites\all\modules\calendar\calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of D:\wamp\www\aclv2\sites\all\modules\calendar\calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 151 of D:\wamp\www\aclv2\sites\all\modules\calendar\calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of D:\wamp\www\aclv2\sites\all\modules\calendar\calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 152 of D:\wamp\www\aclv2\sites\all\modules\calendar\calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 153 of D:\wamp\www\aclv2\sites\all\modules\calendar\calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of D:\wamp\www\aclv2\sites\all\modules\calendar\calendar.module).
wayne57’s picture

I am also getting this error.
I have recently installed the token and pathauto modules, and am not sure whether this notice appeared before.
Is there a fix for this?

wayne57’s picture

for completeness, this is the error i get:

Notice: Undefined variable: type in calendar_granularity_path() (line 518 of /home/kymbrbqx/public_html/sites/all/modules/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of /home/kymbrbqx/public_html/sites/all/modules/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of /home/kymbrbqx/public_html/sites/all/modules/calendar/calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 151 of /home/kymbrbqx/public_html/sites/all/modules/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of /home/kymbrbqx/public_html/sites/all/modules/calendar/calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 152 of /home/kymbrbqx/public_html/sites/all/modules/calendar/calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 153 of /home/kymbrbqx/public_html/sites/all/modules/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of /home/kymbrbqx/public_html/sites/all/modules/calendar/calendar.module).
wayne57’s picture

I fixed this.
I had two calendar views enabled. I forgot to disable after I cloned. Also I set the format to Calendar Items (DEPRECATED, switch to Calendar Entities) by mistake and after I corrected this failed to notice it had set on all displays.

I deleted the entire view, cloned a new one and disabled the default, now everything works fine.

karens’s picture

Status: Needs review » Fixed

So this is fixed, right? If it works right in the latest dev there is no bug.

Jaza’s picture

Status: Fixed » Needs review

I'm still getting this error. After upgrading to latest views, uninstalling and re-installing calendar module, and re-creating my calendar view (this time, using the new 'add view from template' feature), same problem.

Note: the error reported by wayne57 above was:

Undefined variable: type in calendar_granularity_path() (line 518

Whereas mine is:

Undefined offset: 2 in calendar_granularity_path() (line 526

(Was 'offset: 3', has now changed to 'offset: 2', otherwise same error).

So, would seem to me that wayne57's reported problem is a different one, possibly one that can be fixed without a patch.

Applying my patch still fixes this issue, for me.

karens’s picture

Status: Needs review » Fixed

I can't replicate the error but the patch makes sense, so committing it.

http://drupalcode.org/project/calendar.git/commit/3bac338

josaku’s picture

StatusFileSize
new1.34 KB

I have the following similar notice after upgrading to 7.x-3.0.
Notice: Undefined index: arguments calendar_granularity_path()...

I'm not sure but the attached patch works for me.

hynnot’s picture

+1 #4 Posted by wayne57

If you enter to the view, you can change the format DEPRECATED to Calendar Entities. Not it's necessary delete the view.

janeinar’s picture

Version: 7.x-2.x-dev » 7.x-3.0

The patch worked for me.

dealancer’s picture

patch #8 fixed only some of notices, while I am continue to get other notices/

Notice: Undefined variable: type in calendar_granularity_path() (line 522 of /var/www/commonweal/sites/all/modules/contrib/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 522 of /var/www/commonweal/sites/all/modules/contrib/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 522 of /var/www/commonweal/sites/all/modules/contrib/calendar/calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 153 of /var/www/commonweal/sites/all/modules/contrib/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 522 of /var/www/commonweal/sites/all/modules/contrib/calendar/calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 154 of /var/www/commonweal/sites/all/modules/contrib/calendar/calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 155 of /var/www/commonweal/sites/all/modules/contrib/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 522 of /var/www/commonweal/sites/all/modules/contrib/calendar/calendar.module).
dealancer’s picture

Status: Fixed » Needs review
StatusFileSize
new1.71 KB

Here is a patch that fixes errors mentioned in the issue and comments #1, #3 and #11. Based on patch #8.

fraygos’s picture

The patch in number 12 worked for me.
Will these patches go to the next commit/update?

Or else I am going to be running into the same problem again ... :(

I tried changing the format and errors still happening. Trying to remove the view and re-add was not helping either ...

Thanks for the patch

stijn vanhandsaeme’s picture

patch #12 workd for me. Thanks!

drod’s picture

Patch #12 worked perfect. Thanks!

dealancer’s picture

Cool :) Can anyone review the code and update issue status to 'reviewed and tested by the community'?

audua’s picture

I only get this error after I try to use features with calendar. Has anyone tried this? I have not apply the patch on #12

dealancer’s picture

I am also using Features, have not checked without them.

alex.neblett’s picture

Status: Needs review » Reviewed & tested by the community

Patch works great. Have tested extensively even in corner cases.

Please tested my patch as well:

http://drupal.org/node/1466698

Great job,

Alex

m-si’s picture

I have been patching current 3.x dev with patch #12. patch of #12 does corrupt links of day numbers in month view (if one uses the deprecated calender view) they link points to month view instead of day view. The patch didn't work for me

sorry
m-si

update: #11 in this fixed the whole bug without patching

athrylith’s picture

I had the same problem when using features, applying the patch #12 solved the problem

Cheers

Martyn

jlea9378’s picture

Worked for me also. Can this get committed in dev?

penguininja’s picture

I can confirm that in my case this error only appears when my calendar view is managed by Features. I created a new view without errors, and it wasn't until I pushed that view to code that the errors showed up.

The patch in comment 12 does remove the errors, but it also removes the "Month" tab. Is anyone else experiencing this issue?

@m-si I'm also seeing the incorrect day link issue you mentioned, though not necessarily related to the patch. AFAICT this happens whenever my calendar view is in code, with or without the patch in 12.

jlea9378’s picture

My month tab didn't vanish. However, my year tab points to my upcoming page (within the calendar-date view). But I am certain this is unrelated to the patch.

tac11tac’s picture

Version: 7.x-3.0 » 7.x-3.x-dev

I was having a variety of issues after upgrading to Calendar 7.x-3.x. Finally, I committed to getting everything up to the latest and greatest. Including updating to the -dev version.

Drupal 7.12
Calendar 7.x-3.0+4-dev
Date 7.x-2.2
Views 7.x-3.3
Ctools 7.x-1.0-rc1

I've got everything displaying fine, now, however still getting these Notices and Warnings on every /calendar/* page. How would I use the above patch(s) to hopefully fix this problem? I am a developer, but not a php/drupal developer... yet. It is coming.

Thanks.

Todd

Notice: Undefined index: arguments in calendar_granularity_path() (line 512 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Warning: Invalid argument supplied for foreach() in calendar_granularity_path() (line 512 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Notice: Undefined index: arguments in calendar_granularity_path() (line 512 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Warning: Invalid argument supplied for foreach() in calendar_granularity_path() (line 512 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Notice: Undefined index: arguments in calendar_granularity_path() (line 512 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Warning: Invalid argument supplied for foreach() in calendar_granularity_path() (line 512 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Notice: Undefined index: arguments in calendar_preprocess_date_views_pager() (line 144 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Warning: Invalid argument supplied for foreach() in calendar_preprocess_date_views_pager() (line 144 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 151 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Notice: Undefined index: arguments in calendar_granularity_path() (line 512 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Warning: Invalid argument supplied for foreach() in calendar_granularity_path() (line 512 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 152 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 153 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Notice: Undefined index: arguments in calendar_granularity_path() (line 512 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Warning: Invalid argument supplied for foreach() in calendar_granularity_path() (line 512 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 518 of /home/content/28/8463028/html/sites/all/modules/calendar/calendar.module).

rwilson0429’s picture

Patch in #12 worked for me too. Thanks dealancer.

jlea9378’s picture

@tac11tac:
Save the patch to a file (right-click and save as), then put it in your Calendar module directory. From the command line run the command 'patch < filename.patch' where filename is whatever the name of the patch is. If it prompts for the file to be patched, that would be calendar.module, which should be in your current working directory.

spgd01’s picture

#12 fixed my issue here:
http://drupal.org/node/1441554

RyanPrice’s picture

Can also confirm patch in #12 worked for me. Thank you.

delty’s picture

Confirmed #12 also fixed it for me. Thanks!

Foonaka’s picture

Patch in #12 also worked for me! Thanks!

drgoplayer’s picture

Deleting all the views and creating a new view from "Add view from template" worked for me without applying the patch. See http://209.191.186.157/calendar-field-event-date/month

karens’s picture

Status: Reviewed & tested by the community » Fixed
wielrijder’s picture

I was having the same problem and before trying the patch tried out drgoplayer's #32 fix and found it worked for me too. Thanks for the tip....

Frederic wbase’s picture

Altough this issue is verry strange patch from #12 works wunderfull, many thanks!

arlinsandbulte’s picture

@wielrijder & @Frederic wbase:
KarenS said she fixed this in #33.
It would be best if you confirmed her fix by using the latest -dev instead of testing patches that have not and will not be applied.

Frederic wbase’s picture

@arlinsandbulte i've tried the commit but the problem remains the same for me

a1russell’s picture

Status: Fixed » Needs work

I am also still experiencing this problem with the latest 3.x-dev version.

Notice: Undefined variable: type in calendar_granularity_path() (line 529 of /path/to/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 529 of /path/to/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 529 of /path/to/calendar/calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 161 of /path/to/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 529 of /path/to/calendar/calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 162 of /path/to/calendar/calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 163 of /path/to/calendar/calendar.module).
Notice: Undefined variable: type in calendar_granularity_path() (line 529 of /path/to/calendar/calendar.module).

karens’s picture

Assigned: Jaza » Unassigned
Status: Needs work » Postponed (maintainer needs more info)

Did you pick up the latest version of Date module? Are you still using the deprecated calendar views or did you build new ones using the template? Can you replicate the error on a fresh install? If so, what are the steps to reproduce?

The error does not appear anywhere that I can see when using the right versions of everything. Since I cannot reproduce it in the latest code there is nothing that can be done.

merilainen’s picture

I got rid of the warnings by updating to latest dev-version

emorency’s picture

I had the same problem even if I was using the latest dev version. When the view was created from templates, it worked but after an export/import through a Feature the errors came back...

I found that when the view is exported, Week, Year and Day had the following variable set:

$handler->display->display_options['arguments']['date_argument']['granularity'] = 'week'; // year or day

but the Month display was missing that argument... By manually adding the line:

$handler->display->display_options['arguments']['date_argument']['granularity'] = 'month';

with the month display, it solved part of my problem...

dkingofpa’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new466 bytes

I'm still getting undefined variable notices:
"Notice: Undefined variable: type in calendar_granularity_path() (line 529 of /path/to/calendar/calendar.module)."

Using Date 7.x-2.3 and Calendar cloned from 7.x-3.x (commit: 3f4c3c70f25b980800e381e81d99f74a3ccf7711).

I applied the attached patch and no longer get those notices.

dkingofpa’s picture

I'm still getting undefined variable notices:

Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 161 of /path/to/calendar/calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 162 of /path/to/calendar/calendar.module).
Notice: Undefined variable: type in calendar_preprocess_date_views_pager() (line 163 of /path/to/calendar/calendar.module).

Using Date 7.x-2.3 and Calendar cloned from 7.x-3.x (commit: 3f4c3c70f25b980800e381e81d99f74a3ccf7711).

I applied the attached patch and no longer get those notices.

schultetwin’s picture

#41 Also fixed my issue. Nice catch, I would have never have thought to look at that.

karens’s picture

Status: Needs review » Fixed

The remaining issues are eliminated by #1535346: Rework calendar tabs, which gets rid of the custom tabs.

a1russell’s picture

Status: Fixed » Needs review

This issue is not fixed as of today using dev versions of Calendar, Ctools, Entity, Date, and using the Calendar Entities format:

Notice: Undefined variable: type in calendar_granularity_path() (line 523 of /path/to/calendar/calendar.module).

karens’s picture

Status: Needs review » Fixed

OK, yes, Views omits that value in an export, so we need a default fallback. Fixed slightly differently:

http://drupalcode.org/project/calendar.git/commit/e6629e1

Frederic wbase’s picture

Thanks for the effort KarenS, in a couple of days i will test it out and post my feedback over here

a1russell’s picture

The fix seems to work for me. Thanks!

tac11tac’s picture

From #25 above... upgraded to latest dev on ?4/18? and it fixed the issue. Current version is 7.x-3.2+0-dev.

Thanks.

Todd

q11q11’s picture

Status: Fixed » Closed (fixed)

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