If I deactivate the Distinct Flag it works.
View definition:
$view = new view;
$view->name = 'clientes';
$view->description = 'Lista de clientes';
$view->tag = 'clientes';
$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', 'Lista clientes', 'default');
$handler->override_option('fields', array(
'title' => array(
'label' => 'Nombre',
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
),
'field_representante_uid' => array(
'label' => 'representante',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_representante_uid',
'table' => 'node_data_field_representante',
'field' => 'field_representante_uid',
'relationship' => 'none',
),
'field_canal_venta_value' => array(
'label' => 'Canal de venta',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_canal_venta_value',
'table' => 'node_data_field_canal_venta',
'field' => 'field_canal_venta_value',
'relationship' => 'none',
),
'field_email_email' => array(
'label' => 'Email',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_email_email',
'table' => 'node_data_field_email',
'field' => 'field_email_email',
'relationship' => 'none',
),
'field_fax_value' => array(
'label' => 'Fax',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_fax_value',
'table' => 'node_data_field_fax',
'field' => 'field_fax_value',
'relationship' => 'none',
),
'field_persona_contacto_value' => array(
'label' => 'Persona de contacto',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_persona_contacto_value',
'table' => 'node_data_field_persona_contacto',
'field' => 'field_persona_contacto_value',
'relationship' => 'none',
),
'field_url_url' => array(
'label' => 'Página web',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_url_url',
'table' => 'node_data_field_url',
'field' => 'field_url_url',
'relationship' => 'none',
),
'field_telefono_value' => array(
'label' => 'Teléfono',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_telefono_value',
'table' => 'node_data_field_telefono',
'field' => 'field_telefono_value',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'cliente' => 'cliente',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'field_representante_uid' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'field_representante_uid_op',
'identifier' => 'field_representante_uid',
'label' => 'Representante',
'optional' => 1,
'single' => 1,
'remember' => 0,
'reduce' => 0,
),
'id' => 'field_representante_uid',
'table' => 'node_data_field_representante',
'field' => 'field_representante_uid',
'relationship' => 'none',
'reduce_duplicates' => 0,
'override' => array(
'button' => 'Override',
),
),
'field_canal_venta_value_many_to_one' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'field_canal_venta_value_many_to_one_op',
'identifier' => 'field_canal_venta_value_many_to_one',
'label' => 'Canal de venta',
'optional' => 1,
'single' => 0,
'remember' => 0,
'reduce' => 0,
),
'id' => 'field_canal_venta_value_many_to_one',
'table' => 'node_data_field_canal_venta',
'field' => 'field_canal_venta_value_many_to_one',
'relationship' => 'none',
'reduce_duplicates' => 1,
'override' => array(
'button' => 'Override',
),
),
));
$handler->override_option('access', array(
'type' => 'perm',
'perm' => 'access content',
));
$handler->override_option('title', 'Lista de clientes');
$handler->override_option('use_ajax', TRUE);
$handler->override_option('items_per_page', 20);
$handler->override_option('use_pager', 'mini');
$handler->override_option('use_more', 1);
$handler->override_option('distinct', 1);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 1,
'order' => 'asc',
'columns' => array(
'title' => 'title',
'field_canal_venta_value' => 'field_canal_venta_value',
'field_email_email' => 'field_email_email',
'field_fax_value' => 'field_fax_value',
'field_persona_contacto_value' => 'field_persona_contacto_value',
'field_url_url' => 'field_url_url',
'field_telefono_value' => 'field_telefono_value',
),
'info' => array(
'title' => array(
'sortable' => 1,
'separator' => '',
),
'field_canal_venta_value' => array(
'sortable' => 1,
'separator' => '',
),
'field_email_email' => array(
'sortable' => 1,
'separator' => '',
),
'field_fax_value' => array(
'sortable' => 1,
'separator' => '',
),
'field_persona_contacto_value' => array(
'sortable' => 1,
'separator' => '',
),
'field_url_url' => array(
'sortable' => 1,
'separator' => '',
),
'field_telefono_value' => array(
'sortable' => 1,
'separator' => '',
),
),
'default' => 'title',
));
$handler->override_option('exposed_block', TRUE);
$handler = $view->new_display('page', 'Página todos los clientes', 'page_1');
$handler->override_option('path', 'clientes');
$handler->override_option('menu', array(
'type' => 'normal',
'title' => 'Clientes',
'weight' => '-1',
'name' => 'primary-links',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
$handler = $view->new_display('page', 'Página de clientes de un comercial', 'page_2');
$handler->override_option('fields', array(
'title' => array(
'label' => 'Nombre',
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
),
'field_representante_uid' => array(
'label' => 'representante',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 1,
'id' => 'field_representante_uid',
'table' => 'node_data_field_representante',
'field' => 'field_representante_uid',
'relationship' => 'none',
'override' => array(
'button' => 'Use default',
),
),
'field_canal_venta_value' => array(
'label' => 'Canal de venta',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_canal_venta_value',
'table' => 'node_data_field_canal_venta',
'field' => 'field_canal_venta_value',
'relationship' => 'none',
),
'field_email_email' => array(
'label' => 'Email',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_email_email',
'table' => 'node_data_field_email',
'field' => 'field_email_email',
'relationship' => 'none',
),
'field_fax_value' => array(
'label' => 'Fax',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_fax_value',
'table' => 'node_data_field_fax',
'field' => 'field_fax_value',
'relationship' => 'none',
),
'field_persona_contacto_value' => array(
'label' => 'Persona de contacto',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_persona_contacto_value',
'table' => 'node_data_field_persona_contacto',
'field' => 'field_persona_contacto_value',
'relationship' => 'none',
),
'field_url_url' => array(
'label' => 'Página web',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_url_url',
'table' => 'node_data_field_url',
'field' => 'field_url_url',
'relationship' => 'none',
),
'field_telefono_value' => array(
'label' => 'Teléfono',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_telefono_value',
'table' => 'node_data_field_telefono',
'field' => 'field_telefono_value',
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'field_representante_uid' => array(
'default_action' => 'not found',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'Todos',
'title' => '',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'break_phrase' => 0,
'not' => 0,
'id' => 'field_representante_uid',
'table' => 'node_data_field_representante',
'field' => 'field_representante_uid',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'cliente' => 0,
'page' => 0,
'story' => 0,
'visita' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(),
'validate_argument_type' => 'tid',
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'cliente' => 'cliente',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'field_representante_uid' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => 'field_representante_uid_op',
'label' => 'Representante',
'use_operator' => 0,
'identifier' => 'field_representante_uid',
'optional' => 1,
'single' => 1,
'remember' => 0,
'reduce' => 0,
),
'id' => 'field_representante_uid',
'table' => 'node_data_field_representante',
'field' => 'field_representante_uid',
'relationship' => 'none',
'reduce_duplicates' => 0,
'override' => array(
'button' => 'Use default',
),
),
'field_canal_venta_value_many_to_one' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'field_canal_venta_value_many_to_one_op',
'identifier' => 'field_canal_venta_value_many_to_one',
'label' => 'Canal de venta',
'optional' => 1,
'single' => 0,
'remember' => 0,
'reduce' => 0,
),
'id' => 'field_canal_venta_value_many_to_one',
'table' => 'node_data_field_canal_venta',
'field' => 'field_canal_venta_value_many_to_one',
'relationship' => 'none',
'reduce_duplicates' => 1,
'override' => array(
'button' => 'Override',
),
),
));
$handler->override_option('title', 'Clientes de %1');
$handler->override_option('path', 'user/%/clientes');
$handler->override_option('menu', array(
'type' => 'tab',
'title' => 'Clientes asignados',
'weight' => '-1',
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
Live Preview SQL Query:
SELECT DISTINCT(node.nid) AS nid,
node.title AS node_title,
node_data_field_representante.field_representante_uid AS node_data_field_representante_field_representante_uid,
node_data_field_representante.nid AS node_data_field_representante_nid,
node.type AS node_type,
node_data_field_representante.field_canal_venta_value AS node_data_field_representante_field_canal_venta_value,
node_data_field_representante.field_email_email AS node_data_field_representante_field_email_email,
node_data_field_representante.field_fax_value AS node_data_field_representante_field_fax_value,
node_data_field_representante.field_persona_contacto_value AS node_data_field_representante_field_persona_contacto_value,
node_data_field_representante.field_url_url AS node_data_field_representante_field_url_url,
node_data_field_representante.field_url_title AS node_data_field_representante_field_url_title,
node_data_field_representante.field_url_attributes AS node_data_field_representante_field_url_attributes,
node_data_field_representante.field_telefono_value AS node_data_field_representante_field_telefono_value
FROM node node
LEFT JOIN content_type_cliente node_data_field_representante ON node.vid = node_data_field_representante.vid
WHERE node.type in ('cliente')
ORDER BY node_title ASC
Real SQL Query with error:
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT(node.nid), node.title AS node_title, node_data_field_representant' at line 1 query: SELECT COUNT(*) FROM (SELECT DISTINCT(node.nid) AS DISTINCT(node.nid), node.title AS node_title, node_data_field_representante.field_representante_uid AS node_data_field_representante_field_representante_uid, node_data_field_representante.nid AS node_data_field_representante_nid, node.type AS node_type, node_data_field_representante.field_canal_venta_value AS node_data_field_representante_field_canal_venta_value, node_data_field_representante.field_email_email AS node_data_field_representante_field_email_email, node_data_field_representante.field_fax_value AS node_data_field_representante_field_fax_value, node_data_field_representante.field_persona_contacto_value AS node_data_field_representante_field_persona_contacto_value, node_data_field_representante.field_url_url AS node_data_field_representante_field_url_url, node_data_field_representante.field_url_title AS node_data_field_representante_field_url_title, node_data_field_representante.field_url_attributes AS node_data_field_representante_field_url_attributes, node_data_field_representante.field_telefono_value AS node_data_field_representante_field_telefono_value FROM node node LEFT JOIN content_type_cliente node_data_field_representante ON node.vid = node_data_field_representante.vid WHERE node.type in ('cliente') ORDER BY node_title ASC ) count_alias in /var/www/beissier/sites/default/modules/views/includes/view.inc on line 699.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT(node.nid), node.title AS node_title, node_data_field_representant' at line 1 query: SELECT DISTINCT(node.nid) AS DISTINCT(node.nid), node.title AS node_title, node_data_field_representante.field_representante_uid AS node_data_field_representante_field_representante_uid, node_data_field_representante.nid AS node_data_field_representante_nid, node.type AS node_type, node_data_field_representante.field_canal_venta_value AS node_data_field_representante_field_canal_venta_value, node_data_field_representante.field_email_email AS node_data_field_representante_field_email_email, node_data_field_representante.field_fax_value AS node_data_field_representante_field_fax_value, node_data_field_representante.field_persona_contacto_value AS node_data_field_representante_field_persona_contacto_value, node_data_field_representante.field_url_url AS node_data_field_representante_field_url_url, node_data_field_representante.field_url_title AS node_data_field_representante_field_url_title, node_data_field_representante.field_url_attributes AS node_data_field_representante_field_url_attributes, node_data_field_representante.field_telefono_value AS node_data_field_representante_field_telefono_value FROM node node LEFT JOIN content_type_cliente node_data_field_representante ON node.vid = node_data_field_representante.vid WHERE node.type in ('cliente') ORDER BY node_title ASC LIMIT 0, 20 in /var/www/beissier/sites/default/modules/views/includes/view.inc on line 725.
Comments
Comment #1
merlinofchaos commentedI'm sorry, "doesn't work" is unacceptable in a bug report. For all I know that means it sprouts pink elephants and does the can can while you look on in stunned awe.
Comment #2
arojoal commentedI think you should try to look better the color of the "elephant" since I have attached the SQL Error generated that says that there is some problem near "DISTINCT(node.nid)...."
I seems like new drupal upgrade adds automatically "DISTINCT" parameter to node.nid fields even whe you have put already it in the query because the view has the "Distinct" flag activated.
As I said in my post, if I deactivate "Distinct" flag in the view parameters, everythings works again.
Comment #3
merlinofchaos commentedSee http://drupal.org/node/284392