Commit 0db19f85 authored by merlinofchaos's avatar merlinofchaos
Browse files

#110462: set_distinct didn't properly check to see if the query was already distinct.

parent dac6c57e
......@@ -117,7 +117,8 @@ Views --dev
o 110212: Text patch to clarify date fields.
o 110299: Change nodes per block max size from 2 chars wide to 3, as it was meant to be.
o 110648: Block title not showing up in admin if view only provides block.
o 110462: set_distinct didn't properly check to see if the query was already distinct.
o Distinct filter could mess up summary queries by making them distinct on nid which isn't what is supposed to happen there.
New features:
o 107471: Spiffy new theme wizard features. Thanks Crell!!
o 105081: Save and edit button to save but not go change screens.
......@@ -720,8 +720,10 @@ function views_handler_filter_nodetype($op) {
* Set a query to be distinct as a filter handler
*/
function views_handler_filter_distinct($op, $filter, $filterinfo, &$query) {
$query->set_distinct();
$query->add_groupby('node.nid');
if (!$query->no_distinct) {
$query->set_distinct();
$query->add_groupby('node.nid');
}
}
/*
......
......@@ -249,7 +249,6 @@ function _views_view_build_fields(&$query, &$view) {
* this calls handlers.
*/
function _views_build_summary(&$query, $argtype, $option, $self_sort) {
$arginfo = _views_get_arguments();
if (!function_exists($arginfo[$argtype]['handler'])) {
return false;
......@@ -268,6 +267,7 @@ function _views_build_summary(&$query, $argtype, $option, $self_sort) {
if ($self_sort) {
$arginfo[$argtype]['handler']('sort', $query, $self_sort);
}
$query->no_distinct = TRUE; // prevent DISTINCT from mucking up summaries.
}
// ---------------------------------------------------------------------------
......@@ -332,7 +332,7 @@ class _views_query {
* Set the base field to be distinct.
*/
function set_distinct() {
if (count($this->fields) && substr($this->fields[0], 0, 7) != 'DISTINCT') {
if (count($this->fields) && substr($this->fields[0], 0, 8) != 'DISTINCT') {
$field = $this->fields[0];
$this->fields[0] = "DISTINCT($field)";
$this->count_field = "DISTINCT($field)";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment