On the clear site with some nodes with Date field I configured view which return all node titles. When I added the date field to the view, the view will return nothink.

Export of view:

$view = new view;
$view->name = 'deals';
$view->description = '';
$view->tag = '';
$view->base_table = 'node';
$view->human_name = 'deals';
$view->core = 7;
$view->api_version = '3.0-alpha1';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Pole: Uzly: Nadpis */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['element_label_colon'] = 1;
$handler->display->display_options['fields']['title']['element_default_classes'] = 1;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Pole: Fields: field_date */
$handler->display->display_options['fields']['entity_id']['id'] = 'entity_id';
$handler->display->display_options['fields']['entity_id']['table'] = 'field_data_field_date';
$handler->display->display_options['fields']['entity_id']['field'] = 'entity_id';
$handler->display->display_options['fields']['entity_id']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['trim'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['entity_id']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['entity_id']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['html'] = 0;
$handler->display->display_options['fields']['entity_id']['element_label_colon'] = 1;
$handler->display->display_options['fields']['entity_id']['element_default_classes'] = 1;
$handler->display->display_options['fields']['entity_id']['hide_empty'] = 0;
$handler->display->display_options['fields']['entity_id']['empty_zero'] = 0;
$handler->display->display_options['fields']['entity_id']['settings'] = array(
  'format_type' => 'long',
  'fromto' => 'both',
  'multiple_number' => '',
  'multiple_from' => '',
  'multiple_to' => '',
  'show_repeat_rule' => 'show',
);
/* Filtr: Uzly: Typ */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'article' => 'article',
);

/* Display: Stránka */
$handler = $view->new_display('page', 'Stránka', 'page_1');
$handler->display->display_options['path'] = 'deals';
$translatables['deals'] = array(
  t('Defaults'),
  t('more'),
  t('Apply'),
  t('Reset'),
  t('Sort By'),
  t('Asc'),
  t('Desc'),
  t('Items per page'),
  t('- All -'),
  t('Offset'),
  t('Nadpis'),
  t('field_date'),
  t('Stránka'),
);

Comments

antongaudis’s picture

same here, any date field added to the views returns a blank page. it does works fine for nodes.

karens’s picture

Status: Active » Fixed

The views integration code has all been updated. Please switch to the 7.x-2.x version of Date and Calendar.

honza pobořil’s picture

Status: Fixed » Active

I updated the module, but the result is same.

karens’s picture

Status: Active » Postponed (maintainer needs more info)

I cannot replicate this problem using the 7.x-2.x code. It is not clear what 'updated the code' means. This issue is still marked as a 7.x-1.x issue, so I have no idea if you are using that.

I can add date fields to views just fine.

honza pobořil’s picture

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

New informations: View doesn't show nodes imported by Feeds and nodes with blank value of date field.

honza pobořil’s picture

Another informations: View shows nodes with active lang code, but dont show nodes with "und" lang code. "und" langcode use Feeds to import all nodes.

My site have "cs" set as default language.

Successfully listed nodes:


- language (String, 2 characters ) cs

- field_date (Array, 1 element)
-- cs (Array, 1 element)
--- 0 (Array, 4 elements)
---- value (String, 19 characters ) 2009-04-01T23:01:00
---- timezone (String, 13 characters ) Europe/Berlin
---- timezone_db (String, 3 characters ) UTC
---- date_type (String, 4 characters ) date | (Callback) date();

Not listed nodes:


- language (String, 3 characters ) und

- field_date (Array, 1 element)
-- und (Array, 1 element)
--- 0 (Array, 4 elements)
---- value (String, 19 characters ) 2009-02-04T00:02:00
---- timezone (String, 13 characters ) Europe/Berlin
---- timezone_db (String, 3 characters ) UTC
---- date_type (String, 4 characters ) date | (Callback) date();

honza pobořil’s picture

Title: One date field in view will cancel listing » Views don't list nodes with foreign langcode on date field
Status: Postponed (maintainer needs more info) » Active

Confirmed, it don't list nodes with date field which has langcode different from site's default language.

acoustika’s picture

same, subscribing

a.siebel’s picture

subscribe

gagarine’s picture

#1103982: Adding a Date field to Fields in View adds a Language Filter in where-clause. marked as duplicate

As explain in the other bug report, date add a where clause on language. The language ("en" here) is the one of the current user.

...
WHERE (( (node.status = '1') AND (field_data_field_datum.language = 'en') )AND( (DATE_FORMAT(ADDTIME(STR_TO_DATE(field_data_field_datum.field_datum_value, '%Y-%m-%dT%T'), SEC_TO_TIME(3600)), '%Y-%m') = '2011-03') ))
gagarine’s picture

Title: Views don't list nodes with foreign langcode on date field » Views with date field don't show nodes than have a different language than the curent user language

it also never display node wihtout a specific language (und)

gagarine’s picture

Anonymous’s picture

Ok! I got some help from gagarine and found a workaround. This has to be adapted to your view, based on your filters there will be a different number of conditions in the query.

/**
* Implementation of hook_views_query_alter().
*/
function MODULE_NAME_views_query_alter(&$view, &$query) {
	if ($view->name=='MY_VIEW_NAME') {
		unset($query->where[0]['conditions'][3]);
	}
}
jdanthinne’s picture

Bug is bothering me as well, and I've searched in the module to find where it adds this WHERE clause, but found nothing.
So I had a look to Views and found this at line 152 of views/modules/field/views_handler_field_field.inc :

 if (field_is_translatable($entity_type, $field) && !empty($this->query->options['field_language_add_to_query'])) {
        $column = $this->table_alias . '.language';
        $this->query->add_where(0, $column, $this->query->options['field_language']);
      } 

It seems that it checks if field is translatable and adds the language condition… so the solution (I guess) seems to set the "translatable" setting of field to FALSE?

gagarine’s picture

Status: Active » Closed (duplicate)
Issue tags: +#views

God catch jdanthinne i was able to make better search and find that this bug is a duplicate of #1057544: Date field language handling problems

acoustika’s picture

subscribe...