View filters for CCK Date field didn't properly upgrade

joachim - June 23, 2008 - 08:27
Project:Date
Version:5.x-2.x-dev
Component:Date CCK Field
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I had a View with two filters on the CCK date field:
- date is less than now + 604800. The 604800 was in the option field.
- date is greater than now.
These combined to give me everything taking place in the coming 7 days.

Following upgrade, today's date and time is in the Value field for both filters, and 604800 is in the option field for the first.
The view seems to show me EVERYTHING.

#1

KarenS - June 23, 2008 - 10:30
Status:active» fixed

The -rc version is out of date. If you want to report bugs, first see if things are fixed in the latest code, the -dev version. There have been lots of changes to the filters since the rc version and it should be working fine there.

#2

joachim - June 24, 2008 - 08:02
Status:fixed» active

I'm getting the same problem with today's -dev version.

#3

joachim - June 24, 2008 - 08:07

In fact, it's worse than with the RC release.

After I update the fields to the new format, I get no results.
It looks like this filter doesn't work properly:
- date is less than "now +1 week" in the option field
It's getting treated as simply "now".

#4

jesss - June 27, 2008 - 15:24
Version:5.x-2.0-rc» 5.x-2.x-dev

I'm having this same issue in 5.x-2.x-dev. I'm trying to show board meetings from the last six months (>= now -6 months), but the MySQL query is selecting >= NOW().

Here's the export of my view.

  $view = new stdClass();
  $view->name = 'about_boardmeetings_past';
  $view->description = 'Previous board meetings';
  $view->access = array (
);
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = 'Previous meetings';
  $view->page_header = '';
  $view->page_header_format = '1';
  $view->page_footer = '';
  $view->page_footer_format = '1';
  $view->page_empty = '';
  $view->page_empty_format = '1';
  $view->page_type = 'list';
  $view->url = '';
  $view->use_pager = FALSE;
  $view->nodes_per_page = '0';
  $view->sort = array (
    array (
      'tablename' => 'node_data_field_board_meeting_date',
      'field' => 'field_board_meeting_date_value',
      'sortorder' => 'DESC',
      'options' => '',
    ),
  );
  $view->argument = array (
  );
  $view->field = array (
    array (
      'tablename' => 'node',
      'field' => 'nid',
      'label' => '',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'board_meeting',
),
    ),
    array (
      'tablename' => 'node_data_field_board_meeting_date',
      'field' => 'field_board_meeting_date_value_default',
      'operator' => '>=',
      'options' => 'now -6 months',
      'value' => '',
    ),
  );
  $view->exposed_filter = array (
  );
  $view->requires = array(node_data_field_board_meeting_date, node);
  $views[$view->name] = $view;

And here's the views_build_view query as displayed by the Devel module.

SELECT node.nid, node_data_field_board_meeting_date.field_board_meeting_date_value AS node_data_field_board_meeting_date_field_board_meeting_date_value FROM node node LEFT JOIN content_type_board_meeting node_data_field_board_meeting_date ON node.vid = node_data_field_board_meeting_date.vid WHERE (node.status = '1') AND (node.type IN ('board_meeting')) AND (node_data_field_board_meeting_date.field_board_meeting_date_value >= NOW()) ORDER BY node_data_field_board_meeting_date_field_board_meeting_date_value ASC

I tried applying jjohnsonBLC's suggestion from #247752: Filtering views with date-field (comment #18), but that didn't work.

#5

KarenS - June 30, 2008 - 23:11
Status:active» fixed

The placement for 'now' and '+1' are in different places in the 5.2 code than they were in the 5.1 code, so you'll have to manually fix your filters. I just committed a number of fixes to the Views filters, so try again with the latest -dev code.

#6

jesss - July 1, 2008 - 15:34

That worked. Thanks!

#7

Anonymous (not verified) - July 15, 2008 - 15:44
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.