Fix natural_sort cast to text

If item being sorted is numeric data type need to cast to text.

This would usually be fixed during the upgrade. However BDR prevents using standard alter table data type commands.
This commit is contained in:
FusionPBX 2024-01-10 11:37:10 -07:00 committed by GitHub
parent 13d8a44f81
commit d428119f4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -2099,7 +2099,7 @@
$dir = !empty($dir) && strtolower($dir) == 'desc' ? 'desc' : 'asc';
if (!empty($col)) {
if ($sort == 'natural' && $db_type == "pgsql") {
return $order_by . 'natural_sort(' . $col . ') ' . $dir . ' ';
return $order_by . 'natural_sort(' . $col . '::text) ' . $dir . ' ';
} else {
return $order_by . $col . ' ' . $dir . ' ';
}
@ -2114,7 +2114,7 @@
}
} else {
if ($sort == 'natural' && $db_type == "pgsql") {
return $order_by . 'natural_sort(' . $col_default . ') ' . $dir_default . ' ';
return $order_by . 'natural_sort(' . $col_default . '::text) ' . $dir_default . ' ';
} else {
return $order_by . $col_default . ' ' . $dir_default . ' ';
}