mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-02 00:46:44 +01:00
Fix ulteriore per ordinamento campi viste
This commit is contained in:
parent
537c4c86db
commit
0cb6f79cda
@ -80,13 +80,7 @@ if (!empty($module_query) && $module_query != 'menu' && $module_query != 'custom
|
||||
unset($pieces[$cont - 1]);
|
||||
}
|
||||
|
||||
$order_by = $total['order_by'][$order['column']];
|
||||
|
||||
if( strstr( $order_by, ' ' ) ){
|
||||
$order_by = '`'.$order_by.'`';
|
||||
}
|
||||
|
||||
$module_query = implode('ORDER', $pieces).' ORDER BY '.$order_by.' '.$order['dir'];
|
||||
$module_query = implode('ORDER', $pieces).' ORDER BY '.$total['order_by'][$order['column']].' '.$order['dir'];
|
||||
}
|
||||
|
||||
// Calcolo di eventuali somme
|
||||
|
@ -226,7 +226,24 @@ class Modules
|
||||
$fields[] = trim($data['name']);
|
||||
|
||||
$search_inside[] = !empty($data['search_inside']) ? $data['search_inside'] : $data['name'];
|
||||
$order_by[] = !empty($data['order_by']) ? $data['order_by'] : $data['name'];
|
||||
|
||||
// Se non è specificato `order_by`, uso il nome del campo
|
||||
if( empty($data['order_by']) ){
|
||||
// Se nel nome ci sono solo caratteri alfanumerici (quindi NON funzioni),
|
||||
// inserisco il simbolo ` a inizio e fine campo, altrimenti campi con gli spazi
|
||||
// danno errore nell'ordinamento
|
||||
if( preg_match( '/([a-zA-Z0-9\_\-]+)/', $data['name']) ){
|
||||
$order_by[] = '`'.$data['name'].'`';
|
||||
} else {
|
||||
$order_by[] = $data['name'];
|
||||
}
|
||||
}
|
||||
|
||||
// ...altrimenti uso `order_by`
|
||||
else{
|
||||
$order_by[] = $data['order_by'];
|
||||
}
|
||||
|
||||
$search[] = $data['search'];
|
||||
$slow[] = $data['slow'];
|
||||
$format[] = $data['format'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user