Fixing document list order see BT#7070 and BT#6548

Fixing be2304e4bb
1.9.x
Julio Montoya 12 years ago
parent d5e9b209f7
commit afa7436f01
  1. 4
      main/document/document.php
  2. 14
      main/inc/lib/table_sort.class.php

@ -761,6 +761,7 @@ $documentAndFolders = DocumentManager::get_all_document_data(
$is_allowed_to_edit || $group_member_with_upload_rights,
false
);
$count = 1;
$jquery = null;
@ -1725,7 +1726,8 @@ $table = new SortableTableFromArrayConfig(
$tableName,
$column_show,
$column_order,
'ASC'
'ASC',
true
);
$query_vars = array();
if (isset($_GET['keyword'])) {

@ -98,6 +98,7 @@ class TableSort
if (!is_array($data) || empty($data)) {
return array();
}
if ($column != strval(intval($column))) {
// Probably an attack
return $data;
@ -125,7 +126,7 @@ class TableSort
}
}
//This fixs only works in the document tool when ordering by name
//This fixes only works in the document tool when ordering by name
if ($doc_filter && in_array($type, array(SORT_STRING))) {
$folder_to_sort = array();
$new_data = array();
@ -138,21 +139,23 @@ class TableSort
}
$new_data[$document['id']] = $document;
}
if ($direction == SORT_ASC) {
if (!empty($docs_to_sort)) {
api_natrsort($docs_to_sort);
api_natsort($docs_to_sort);
}
if (!empty($folder_to_sort)) {
api_natrsort($folder_to_sort);
api_natsort($folder_to_sort);
}
} else {
if (!empty($docs_to_sort)) {
api_natsort($docs_to_sort);
api_natrsort($docs_to_sort);
}
if (!empty($folder_to_sort)) {
api_natsort($folder_to_sort);
api_natrsort($folder_to_sort);
}
}
$new_data_order = array();
if (!empty($docs_to_sort)) {
foreach($docs_to_sort as $id => $document) {
@ -161,6 +164,7 @@ class TableSort
}
}
}
if (!empty($folder_to_sort)) {
foreach($folder_to_sort as $id => $document) {
if (isset($new_data[$id])) {

Loading…
Cancel
Save