Impianti filtrati per attività su aggiunta articolo

This commit is contained in:
Bacca97 2018-04-23 17:28:39 +02:00
parent 4c2fee979b
commit 1a1548a396
2 changed files with 17 additions and 1 deletions

View File

@ -13,6 +13,8 @@ $can_edit_prezzi = (in_array('Amministratori', $gruppi)) || (get_var('Mostra i p
$idriga = get('idriga'); $idriga = get('idriga');
$idautomezzo = (get('idautomezzo') == 'undefined') ? '' : get('idautomezzo'); $idautomezzo = (get('idautomezzo') == 'undefined') ? '' : get('idautomezzo');
$_SESSION['superselect']['idintervento'] = get('id_record');
// Lettura idanagrafica cliente e percentuale di sconto/rincaro in base al listino // Lettura idanagrafica cliente e percentuale di sconto/rincaro in base al listino
$rs = $dbo->fetchArray('SELECT idanagrafica FROM in_interventi WHERE id='.prepare($id_record)); $rs = $dbo->fetchArray('SELECT idanagrafica FROM in_interventi WHERE id='.prepare($id_record));

View File

@ -4,7 +4,21 @@ include_once __DIR__.'/../../../core.php';
switch ($resource) { switch ($resource) {
case 'impianti': case 'impianti':
if (isset($superselect['idanagrafica'])) { 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'])) {
$query = 'SELECT id, CONCAT(matricola, " - ", nome) AS descrizione FROM my_impianti |where| ORDER BY idsede'; $query = 'SELECT id, CONCAT(matricola, " - ", nome) AS descrizione FROM my_impianti |where| ORDER BY idsede';
foreach ($elements as $element) { foreach ($elements as $element) {