Commit 3b8cb14a authored by David Lesieur's avatar David Lesieur

Fixed SQL error when sorting by date.

parent 43f7d578
......@@ -128,13 +128,7 @@ class date_facet extends cck_facet {
*/
function build_sort_query_count(&$query) {
$query->add_orderby('count', 'DESC');
$query->add_orderby($this->_field['field_name'] .'_year', 'ASC');
if ($query->has_field($this->_field['field_name'] .'_month')) {
$query->add_orderby($this->_field['field_name'] .'_month', 'ASC');
if ($query->has_field($this->_field['field_name'] .'_day')) {
$query->add_orderby($this->_field['field_name'] .'_day', 'ASC');
}
}
$this->build_sort_query_field($query);
}
/**
......@@ -142,8 +136,12 @@ class date_facet extends cck_facet {
*/
function build_sort_query_field(&$query) {
$query->add_orderby($this->_field['field_name'] .'_year', 'ASC');
$query->add_orderby($this->_field['field_name'] .'_month', 'ASC');
$query->add_orderby($this->_field['field_name'] .'_day', 'ASC');
if ($query->has_field($this->_field['field_name'] .'_month')) {
$query->add_orderby($this->_field['field_name'] .'_month', 'ASC');
if ($query->has_field($this->_field['field_name'] .'_day')) {
$query->add_orderby($this->_field['field_name'] .'_day', 'ASC');
}
}
}
/**
......
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