Fix select impianti add intervento

Se si aggiunge un articolo ad un intervento, rimanendo settato il session del filtro superselect idintervento, non venivano più mostrati gli impianti del cliente.
This commit is contained in:
Luca 2018-05-26 02:29:12 +02:00
parent 3f09312ede
commit 9e34ed1170
1 changed files with 15 additions and 15 deletions

View File

@ -4,21 +4,7 @@ include_once __DIR__.'/../../../core.php';
switch ($resource) {
case 'impianti':
if( isset($superselect['idintervento']) ){
$query = 'SELECT id, CONCAT(matricola, " - ", nome) AS descrizione FROM my_impianti INNER JOIN my_impianti_interventi ON my_impianti.id=my_impianti_interventi.idimpianto |where| ORDER BY idsede';
foreach ($elements as $element) {
$filter[] = 'id='.prepare($element);
}
$where[] = 'my_impianti_interventi.idintervento='.prepare($superselect['idintervento']);
if (!empty($search)) {
$search_fields[] = 'nome LIKE '.prepare('%'.$search.'%');
$search_fields[] = 'matricola LIKE '.prepare('%'.$search.'%');
}
}
elseif (isset($superselect['idanagrafica'])) {
if (isset($superselect['idanagrafica'])) {
$query = 'SELECT id, CONCAT(matricola, " - ", nome) AS descrizione FROM my_impianti |where| ORDER BY idsede';
foreach ($elements as $element) {
@ -33,5 +19,19 @@ switch ($resource) {
$search_fields[] = 'matricola LIKE '.prepare('%'.$search.'%');
}
}
elseif( isset($superselect['idintervento']) ){
$query = 'SELECT id, CONCAT(matricola, " - ", nome) AS descrizione FROM my_impianti INNER JOIN my_impianti_interventi ON my_impianti.id=my_impianti_interventi.idimpianto |where| ORDER BY idsede';
foreach ($elements as $element) {
$filter[] = 'id='.prepare($element);
}
$where[] = 'my_impianti_interventi.idintervento='.prepare($superselect['idintervento']);
if (!empty($search)) {
$search_fields[] = 'nome LIKE '.prepare('%'.$search.'%');
$search_fields[] = 'matricola LIKE '.prepare('%'.$search.'%');
}
}
break;
}