Date 6.x-2.3, PHP 5.2.6, Drupal 6.13
This does not seem to be the same as the other views-related issues posted here...
I have created a view to show upcoming events, so I added a filter on date: date (node) and specified my date field and >= 'now'
The date filter clause does not appear at all in the preview query, and all event nodes are shown in the result set. It happened first in a calendar view, so I created a separate view with just one display to see if that would fix it. I am still getting the same problem.
Any suggestions? thanks
Here's the preview query:
SELECT node.nid AS nid,
node_data_field_eventdate.field_eventdate_value AS node_data_field_eventdate_field_eventdate_value,
node_data_field_eventdate.field_eventdate_value2 AS node_data_field_eventdate_field_eventdate_value2,
node.type AS node_type,
node.vid AS node_vid,
node.title AS node_title
FROM node node
INNER JOIN term_node term_node ON node.vid = term_node.vid
LEFT JOIN content_type_event node_data_field_eventdate ON node.vid = node_data_field_eventdate.vid
WHERE (node.status <> 0) AND (node.type in ('event')) AND (term_node.tid = 2)
ORDER BY node_data_field_eventdate_field_eventdate_value ASC
here's the view export:
$view = new view;
$view->name = 'music_upc_event_blk';
$view->description = 'Upcoming Events Block';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'field_eventdate_value' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'short',
'multiple' => array(
'multiple_number' => '',
'multiple_from' => '',
'multiple_to' => '',
'group' => TRUE,
),
'repeat' => array(
'show_repeat_rule' => '',
),
'fromto' => array(
'fromto' => 'value',
),
'exclude' => 0,
'id' => 'field_eventdate_value',
'table' => 'node_data_field_eventdate',
'field' => 'field_eventdate_value',
'relationship' => 'none',
),
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'field_eventdate_value' => array(
'order' => 'ASC',
'delta' => -1,
'id' => 'field_eventdate_value',
'table' => 'node_data_field_eventdate',
'field' => 'field_eventdate_value',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'date_filter' => array(
'operator' => '>=',
'value' => array(
'value' => NULL,
'min' => NULL,
'max' => NULL,
'default_date' => '\'now\'',
'default_to_date' => '',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'date_fields' => array(
'node_data_field_eventdate.field_eventdate_value' => 'node_data_field_eventdate.field_eventdate_value',
),
'date_method' => 'OR',
'granularity' => 'day',
'form_type' => 'date_select',
'default_date' => '\'now\'',
'default_to_date' => '',
'year_range' => '-3:+3',
'id' => 'date_filter',
'table' => 'node',
'field' => 'date_filter',
'relationship' => 'none',
),
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'event' => 'event',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'tid' => array(
'operator' => 'or',
'value' => array(
'2' => '2',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'type' => 'select',
'limit' => TRUE,
'vid' => '3',
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
'hierarchy' => 0,
'relationship' => 'none',
'reduce_duplicates' => 0,
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('header', '<h3 class="feature">Upcoming events:</h3>');
$handler->override_option('header_format', '4');
$handler->override_option('header_empty', 0);
$handler->override_option('empty', 'Stay tuned for new events!');
$handler->override_option('empty_format', '4');
$handler->override_option('items_per_page', 4);
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
Comments
Comment #1
peter törnstrand commentedI'm having the same problem. It only occurs when I'm using a date argument on the view. If I preview the view not specifying any argument the filter is applied. If I specify the argument the filter is not applied.
Solution: Check the AND option under method in the filter and argument.
Comment #2
geerlingguy commentedSame problem here, using 6.x-2.x-dev - changing the AND option didn't help :(
It seems the whole filter is ignored completely. This is the view I use to create the "Upcoming Events" block on the right side of www.archstl.org - the home page. Everything else (calendars, etc.) works perfectly, as far as I can tell.
Comment #3
geerlingguy commentedI fixed this on my site: it turns out that, since we were using the built-in 'Calendar' view supplied by the Calendar module, the Date argument was being applied to our modified 'Upcoming Events' block (seen on the home page of archstl.org).
We removed the Date: Date (node) argument from the Upcoming Block display (only), and set the Date: Date (node) filter to show event nodes greater than or equal to today. Now the view's working great!
(cross posted from http://archstldev.com/node/469#comment-557)
Comment #4
karens commentedI think was caused by the same problem as #580178: Views: SQL Error "Unknown column" when using fields from different content-types in a filter. I reverted that change and I think things are working again.