From 4c5137e3d15581411f460c7a51fbd3d76358ea5f Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 15 Nov 2018 19:06:42 +0100 Subject: [PATCH] Migliorie ddt --- modules/anagrafiche/ajax/select.php | 4 ++-- modules/beni/actions.php | 4 ++++ modules/beni/ajax/select.php | 18 ++++++++++++++++++ modules/causali/actions.php | 4 ++++ modules/causali/ajax/select.php | 18 ++++++++++++++++++ modules/ddt/edit.php | 4 ++-- 6 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 modules/beni/ajax/select.php create mode 100644 modules/causali/ajax/select.php diff --git a/modules/anagrafiche/ajax/select.php b/modules/anagrafiche/ajax/select.php index 79167c1c4..4a3782f92 100644 --- a/modules/anagrafiche/ajax/select.php +++ b/modules/anagrafiche/ajax/select.php @@ -132,7 +132,7 @@ switch ($resource) { case 'sedi': if (isset($superselect['idanagrafica'])) { - $query = "SELECT * FROM (SELECT 0 AS id, 'Sede legale' AS descrizione UNION SELECT id, CONCAT_WS(' - ', nomesede, citta) FROM an_sedi |where|) AS tab |filter| ORDER BY id"; + $query = "SELECT * FROM (SELECT 0 AS id, 'Sede legale' AS descrizione UNION SELECT id, CONCAT_WS(' - ', nomesede, citta) FROM an_sedi |where|) AS tab |filter| ORDER BY descrizione"; foreach ($elements as $element) { $filter[] = 'id='.prepare($element); @@ -149,7 +149,7 @@ switch ($resource) { case 'referenti': if (isset($superselect['idanagrafica'])) { - $query = 'SELECT id, nome AS descrizione FROM an_referenti |where| ORDER BY id'; + $query = 'SELECT id, nome AS descrizione FROM an_referenti |where| ORDER BY nome'; foreach ($elements as $element) { $filter[] = 'id='.prepare($element); diff --git a/modules/beni/actions.php b/modules/beni/actions.php index 27e2df59e..a8a0c4637 100644 --- a/modules/beni/actions.php +++ b/modules/beni/actions.php @@ -24,6 +24,10 @@ switch (post('op')) { $dbo->query('INSERT INTO `dt_aspettobeni` (`descrizione`) VALUES ('.prepare($descrizione).')'); $id_record = $dbo->lastInsertedID(); + + if (isAjaxRequest()) { + echo json_encode(['id' => $id_record, 'text' => $descrizione]); + } flash()->info(tr('Aggiunta nuova tipologia di _TYPE_', [ '_TYPE_' => 'bene', diff --git a/modules/beni/ajax/select.php b/modules/beni/ajax/select.php new file mode 100644 index 000000000..c570065e1 --- /dev/null +++ b/modules/beni/ajax/select.php @@ -0,0 +1,18 @@ + $descrizione, ]); $id_record = $dbo->lastInsertedID(); + + if (isAjaxRequest()) { + echo json_encode(['id' => $id_record, 'text' => $descrizione]); + } flash()->info(tr('Aggiunta nuova tipologia di _TYPE_', [ '_TYPE_' => 'causale', diff --git a/modules/causali/ajax/select.php b/modules/causali/ajax/select.php new file mode 100644 index 000000000..fa0840ab9 --- /dev/null +++ b/modules/causali/ajax/select.php @@ -0,0 +1,18 @@ +
- {[ "type": "select", "label": "", "name": "idaspettobeni", "placeholder": "-", "values": "query=SELECT id, descrizione FROM dt_aspettobeni ORDER BY descrizione ASC", "value": "$idaspettobeni$", "readonly": "" ]} + {[ "type": "select", "label": "", "name": "idaspettobeni", "value": "$idaspettobeni$", "ajax-source": "aspetto-beni", "readonly": "", "icon-after": "add|" ]}
- {[ "type": "select", "label": "", "name": "idcausalet", "placeholder": "-", "values": "query=SELECT id, descrizione FROM dt_causalet ORDER BY descrizione ASC", "value": "$idcausalet$", "readonly": "" ]} + {[ "type": "select", "label": "", "name": "idcausalet", "value": "$idcausalet$", "ajax-source": "causali", "readonly": "", "icon-after": "add|" ]}