Commit a3aeafa3 authored by merlinofchaos's avatar merlinofchaos

#138642: Fix summary sorting for taxonomy letter and node letter arguments.

parent 5de5446f
......@@ -513,15 +513,16 @@ function views_handler_arg_nodetype($op, &$query, $argtype, $arg = '') {
}
function views_handler_arg_nodeletter($op, &$query, $argtype, $arg = '') {
static $field = NULL;
switch($op) {
case 'summary':
$len = intval($arg);
$fieldinfo['field'] = ($len <= 0 ? "node.title" : $fieldinfo['field'] = "LEFT(node.title, $len)");
$field = $fieldinfo['field'] = ($len <= 0 ? "node.title" : $fieldinfo['field'] = "LEFT(node.title, $len)");
$fieldinfo['fieldname'] = 'letter';
return $fieldinfo;
break;
case 'sort':
$query->add_orderby('node', 'title', $argtype);
$query->add_orderby('node', $field, $argtype, 'letter');
break;
case 'filter':
$len = intval($argtype['options']);
......
......@@ -377,11 +377,12 @@ function views_handler_arg_vocid($op, &$query, $argtype, $arg = '') {
}
function views_handler_arg_taxletter($op, &$query, $argtype, $arg = '') {
static $field = NULL;
switch($op) {
case 'summary':
$query->add_table('term_data', true);
$len = intval($arg);
$fieldinfo['field'] = ($len <= 0 ? "term_data.name" : "LEFT(term_data.name, $len)");
$field = $fieldinfo['field'] = ($len <= 0 ? "term_data.name" : "LEFT(term_data.name, $len)");
$fieldinfo['fieldname'] = 'letter';
$query->add_field('tid', 'term_data');
......@@ -389,7 +390,7 @@ function views_handler_arg_taxletter($op, &$query, $argtype, $arg = '') {
return $fieldinfo;
break;
case 'sort':
$query->add_orderby('term_data', 'name', $argtype);
$query->add_orderby('', $field, $argtype, 'letter');
break;
case 'filter':
$len = intval($argtype['options']);
......
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