diff options
author | Stephane Proulx <stephane@m-42.com> | 2018-11-25 03:49:00 +0300 |
---|---|---|
committer | stephane <stephane@m-42.com> | 2018-11-25 17:13:48 +0300 |
commit | fcfe9aaa2afed86b72bb39907eda03c3152cac70 (patch) | |
tree | 2e0f7955078aa264a14f9f433dab98b830b848ed /libraries | |
parent | 552ac6100b8c97806f16fab2af33e769059b1f4f (diff) |
Change expected variable to array instead of string
Whole array of sort expressions needed to correctly build "sort by key" drop down menu
Fixes bug #14339
Signed-off-by: Stephane Proulx <stephane@m-42.com>
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/classes/Display/Results.php | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/libraries/classes/Display/Results.php b/libraries/classes/Display/Results.php index 2d815eff8e..28195ae276 100644 --- a/libraries/classes/Display/Results.php +++ b/libraries/classes/Display/Results.php @@ -1344,8 +1344,8 @@ class Results /** * Prepare unsorted sql query and sort by key drop down * - * @param array $analyzed_sql_results analyzed sql results - * @param string $sort_expression sort expression + * @param array $analyzed_sql_results analyzed sql results + * @param array|null $sort_expression sort expression * * @return array two element array - $unsorted_sql_query, $drop_down_html * @@ -1354,7 +1354,7 @@ class Results * @see _getTableHeaders() */ private function _getUnsortedSqlAndSortByKeyDropDown( - array $analyzed_sql_results, $sort_expression + array $analyzed_sql_results, array $sort_expression ) { $drop_down_html = ''; @@ -1389,9 +1389,9 @@ class Results /** * Prepare sort by key dropdown - html code segment * - * @param Index[] $indexes the indexes of the table for sort criteria - * @param string $sort_expression the sort expression - * @param string $unsorted_sql_query the unsorted sql query + * @param Index[] $indexes the indexes of the table for sort criteria + * @param array|null $sort_expression the sort expression + * @param string $unsorted_sql_query the unsorted sql query * * @return string $drop_down_html html content * @@ -1400,7 +1400,7 @@ class Results * @see _getTableHeaders() */ private function _getSortByKeyDropDown( - $indexes, $sort_expression, $unsorted_sql_query + $indexes, array $sort_expression, $unsorted_sql_query ) { $drop_down_html = ''; @@ -1415,7 +1415,7 @@ class Results . ': <select name="sql_query" class="autosubmit">' . "\n"; $used_index = false; - $local_order = (isset($sort_expression) ? $sort_expression : ''); + $local_order = (is_array($sort_expression) ? implode(', ',$sort_expression) : ''); foreach ($indexes as $index) { @@ -4212,13 +4212,10 @@ class Results // can the result be sorted? if ($displayParts['sort_lnk'] == '1' && ! is_null($analyzed_sql_results['statement'])) { - // At this point, $sort_expression is an array but we only verify - // the first element in case we could find that the table is - // sorted by one of the choices listed in the - // "Sort by key" drop-down + // At this point, $sort_expression is an array list($unsorted_sql_query, $sort_by_key_html) = $this->_getUnsortedSqlAndSortByKeyDropDown( - $analyzed_sql_results, $sort_expression[0] + $analyzed_sql_results, $sort_expression ); } else { |