Commit 5b6f6c10 authored by merlinofchaos's avatar merlinofchaos

Reverting #333439.

parent 8196a14a
......@@ -25,7 +25,6 @@ Views 2.x-dev
o #510910 by mfb: Fixed bug where multiple fields sharing a column in a table was broken so only the final field would display.
o #546586 by dww: Fixed bugs that prevented '0' being a valid rewrite text or empty text for a view field. Also fixes a logic bug regarding the handling of the 'Count the number 0 as empty' setting.
o #507884 by TheRec: Removed matching title (alt) attribute on node links.\
o #333439 by killes: Fix query for multiply inherited taxonomy terms with taxonomy filter.
o #468370 by emackn: Proper timezone support on postgres.
o #508124 by voxpelli: Optionally allow boolean to treat NULL as FALSE.
o #487528 by dereine: Fix typo in 'Maximum length' field instructions.
......
......@@ -89,35 +89,31 @@ class views_handler_argument_term_node_tid_depth extends views_handler_argument
$placeholder = "= %d";
$tids = array($this->argument);
}
$node_table = $this->ensure_my_table();
$group = 'term_node_nid_depth';
$this->query->set_where_group('OR', $group);
// Create a new join to relate the 'term_node' table to our current 'node' table.
$join = new views_join;
$join->construct('term_node', $node_table, 'vid', 'vid');
$term_node = $this->query->add_relationship('term_node', $join, $node);
$this->query->add_where($group, "$term_node.tid $placeholder", $tids);
$subquery = "\n SELECT tn.vid FROM {term_node} tn\n";
$where = " WHERE tn.tid $placeholder\n";
$args = $tids;
$last = "tn";
if ($this->options['depth'] > 0) {
$th_join = new views_join;
$th_join->construct('term_hierarchy', $term_node, 'tid', 'tid');
$term_hierarchy = $this->query->add_relationship('term_hierarchy', $th_join, $term_node);
$subquery .= " LEFT JOIN {term_hierarchy} th ON th.tid = tn.tid\n";
$last = "th";
foreach (range(1, abs($this->options['depth'])) as $count) {
$th_join = new views_join;
$th_join->construct($term_hierarchy, $term_hierarchy, 'parent', 'tid');
$term_hierarchy = $this->query->add_relationship($term_hierarchy, $th_join, $term_hierarchy);
$this->query->add_where($group, "$term_hierarchy.tid $placeholder", $tids);
$subquery .= " LEFT JOIN {term_hierarchy} th$count ON $last.parent = th$count.tid\n";
$where .= " OR th$count.tid $placeholder\n";
$args = array_merge($args, $tids);
$last = "th$count";
}
}
else if ($this->options['depth'] < 0) {
foreach (range(1, abs($this->options['depth'])) as $count) {
$th_join->construct($term_hierarchy, $term_hierarchy, 'tid', 'parent');
$term_hierarchy = $this->query->add_relationship($term_hierarchy, $th_join, $term_hierarchy);
$this->query->add_where($group, "$term_hierarchy.tid $placeholder", $tids);
$subquery .= " LEFT JOIN {term_hierarchy} th$count ON $last.tid = th$count.parent\n";
$where .= " OR th$count.tid $placeholder\n";
$args = array_merge($args, $tids);
$last = "th$count";
}
}
$this->query->add_where(0, "$this->table_alias.$this->real_field IN ($subquery$where )", $args);
}
function title() {
......
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