Miglioramento filtro nazione

This commit is contained in:
Beppe 2020-02-03 15:21:34 +01:00
parent f84b2dd9be
commit a54fe826f6
1 changed files with 3 additions and 1 deletions

View File

@ -283,7 +283,7 @@ switch ($resource) {
break; break;
case 'nazioni': case 'nazioni':
$query = 'SELECT id AS id, CONCAT_WS(\' - \', iso2, nome) AS descrizione FROM an_nazioni |where| ORDER BY CASE WHEN iso2=\'IT\' THEN -1 ELSE iso2 END'; $query = 'SELECT id AS id, iso2, CONCAT_WS(\' - \', iso2, nome) AS descrizione FROM an_nazioni |where| ORDER BY CASE WHEN iso2=\'IT\' THEN -1 ELSE iso2 END';
foreach ($elements as $element) { foreach ($elements as $element) {
$filter[] = 'id='.prepare($element); $filter[] = 'id='.prepare($element);
@ -291,6 +291,8 @@ switch ($resource) {
if (!empty($search)) { if (!empty($search)) {
$search_fields[] = 'nome LIKE '.prepare('%'.$search.'%'); $search_fields[] = 'nome LIKE '.prepare('%'.$search.'%');
$search_fields[] = 'iso2 LIKE '.prepare('%'.$search.'%');
$search_fields[] = 'CONCAT_WS(\' - \', iso2, nome) LIKE '.prepare('%'.$search.'%');
} }
break; break;