Commit 99d4a961 authored by Till Brehm's avatar Till Brehm

Merge branch 'task/sortSpaceNumbers' into 'stable-3.1'

Sort list quota correct

See merge request !949
parents 7a179afe a64c9c80
Pipeline #2018 passed with stage
in 2 minutes and 33 seconds
......@@ -39,6 +39,7 @@ class listform_actions {
private $sortKeys;
private function _sort($aOne, $aTwo) {
$suffixes=array('k' => 1, 'M' => 1024, 'G' => 1048576, 'T' => 1099511627776);
if(!is_array($aOne) || !is_array($aTwo)) return 0;
if(!is_array($this->sortKeys)) $this->sortKeys = array($this->sortKeys);
......@@ -49,6 +50,15 @@ class listform_actions {
}
$a = $aOne[$sKey];
$b = $aTwo[$sKey];
if(preg_match('/(\d+\.?\d*) ([kMGT])B/', $a, $match)) {
$a = $match[1] * $suffixes[$match[2]];
}
if(preg_match('/(\d+\.?\d*) ([kMGT])B/', $b, $match)) {
$b = $match[1] * $suffixes[$match[2]];
}
if(is_string($a)) $a = strtolower($a);
if(is_string($b)) $b = strtolower($b);
if($a < $b) return $sDir == 'DESC' ? 1 : -1;
......@@ -129,7 +139,7 @@ class listform_actions {
// Getting Datasets from DB
$records = $app->db->queryAllRecords($this->getQueryString($php_sort));
$csrf_token = $app->auth->csrf_token_get($app->listform->listDef['name']);
$_csrf_id = $csrf_token['csrf_id'];
$_csrf_key = $csrf_token['csrf_key'];
......
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