Problem/Motivation

Upgraded from 7.x-2.9-alpha2 to beta1 and norice that my server log is now showing the following notice:
Undefined variable: granularity in date_views_plugin_pager->query() (line 285 of //modules/date/date_views/includes/date_views_plugin_pager.inc).

May or may not be related to also having upgraded Views to 7.x-3.7+38-dev to solve another issue.

This is on a production site but there is not noticeable impact.

Has anyone else come across this issue.

Steps to reproduce

  1. Create a view with page
  2. Use a date field as argument
  3. Use date pager. Make sure 'Skip empty pages' is not checked.

Proposed resolution

Fix the PHP warning.

Remaining tasks

  1. write test case - Make sure it fails without fix
  2. Create a patch to fix the failed test case

User interface changes

No more warning.

API changes

N/A

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nimbletoad’s picture

Just ran into this issue as well. Updating to 7.x-2.9-beta1. No solution yet and we have also seen no impact.

lvthunder’s picture

I have this too except it shows on the screen to everyone. I upgraded to Date 7.x-2.9-beta1 and Core 7.33 via drush.

I also just found the way to turn the errors off so that's good.

MXT’s picture

Same issue here.

MXT’s picture

Priority: Normal » Major

Noticed just now a further bad consequence: my calendar (module) pagination between months (or years) does not work anymore.

Mark this as major

jakemonO’s picture

pager also broken in mine. had to roll back the install

Lostboy22’s picture

FileSize
1.02 KB

Easy fix.

change 283-285

date_modify($this->view->date_info->prev_date, '-1 ' . $granularity);
$this->view->date_info->next_date = clone($argument->max_date);
date_modify($this->view->date_info->next_date, '+1 ' . $granularity);

to

date_modify($this->view->date_info->prev_date, '-1 ' . $argument->date_handler->granularity);
$this->view->date_info->next_date = clone($this->view->date_info->prev_date);
date_modify($this->view->date_info->next_date, '+2 ' . $argument->date_handler->granularity);
Lostboy22’s picture

FileSize
1.11 KB
Lostboy22’s picture

Status: Active » Needs review
IBouglas’s picture

Patch works for me. Many thanks to Lostboy22.

MXT’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #7 resolve all issues for me.

Thank you very much.

maximpodorov’s picture

Please commit.

maximpodorov’s picture

FileSize
1.11 KB

Patch in #7 is renamed according to patch name rules.

BBC’s picture

Patch #12 worked for me. Thanks.

k.skarlatos’s picture

+1, works for me

tvl’s picture

Patch #12 worked for me. Thanks.

caspervoogt’s picture

Patch #12 works for me too. RTBC in my book

marcel.jtf’s picture

Patch #7 worked perfectly for my sites and no more errors.

danwonac’s picture

Patch #12 works for me to. However, this exposed a new bug whereby paging forward a month results in skipping months.

Acertijo’s picture

thanks #7

david_garcia’s picture

+1 RTBC

DamienMcKenna’s picture

Version: 7.x-2.9-beta1 » 7.x-2.x-dev

Just confirming that the patch still applies to -dev.

joebest’s picture

Patch worked fine on my site. Thanks!

sgurlt’s picture

#12 works perfect for me!

jox’s picture

Patch #7/#12 works, thanks Lostboy22.

rwilson0429’s picture

Patch in #12 works great. It also fixed a problem I was experiencing of the date pager not working properly in the Calendar module's month and week view displays. Thanks Lostboy22 and maximpodorov.

+1 RTBC

danreb’s picture

Patch #12 works for me too +1 RTBC

Plazik’s picture

#12 works for me too.

Funksmaname’s picture

#12 worked for me too.

iStryker’s picture

#12 works for me too

schifazl’s picture

#12 works, thanks! Hope that it'll get committed soon!

vikramy’s picture

#12 works for me on dev version.

Ether’s picture

Patch is good, but when it will be in dev version ?

erwangel’s picture

#12 worked for me on Date 7.x-2.9-beta2. No more php notices in logs and calendar pagination works fine (year, month, week and day verified)

kingfisher64’s picture

Like #33 said - when will this be committed to dev?

Tested latest dev ( 2015-Mar-04 ) and it's still outputting the error.

Patch FIXES this. :)

Please commit this mr maintainer!

Thanks

vijaycs85’s picture

Issue summary: View changes
vijaycs85’s picture

Issue summary: View changes
vijaycs85’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
2.39 KB

Here is a test-only patch that would fail without fix.

Status: Needs review » Needs work

The last submitted patch, 38: date-2372073-views_pager_warning-38-test-only.patch, failed testing.

vijaycs85’s picture

Status: Needs work » Needs review
FileSize
3.84 KB

Here is the fix (with test).

- Fixed one more warning on title
- Removing #12 changes that not related to this issue
- Added test coverage.

stefan.r’s picture

Status: Needs review » Reviewed & tested by the community

Test looks good!

szt’s picture

#40 works!

podarok’s picture

Status: Reviewed & tested by the community » Fixed

thanks, #40 commited

  • podarok committed 1398920 on 7.x-2.x authored by vijaycs85
    Issue #2372073 by vijaycs85, Lostboy22, maximpodorov, stefan.r:...

Status: Fixed » Closed (fixed)

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