Fix superselect myimpianti per add intervento e add articolo intervento

This commit is contained in:
Luca 2018-05-26 09:27:36 +02:00
parent 9e34ed1170
commit 465b8d61fa
4 changed files with 19 additions and 4 deletions

View File

@ -13,7 +13,6 @@ for ($i = 0; $i < count($rs); ++$i) {
$idriga = get('idriga');
//$idautomezzo = (get('idautomezzo') == 'undefined') ? '' : get('idautomezzo');
//$_SESSION['superselect']['idintervento'] = get('id_record');
// Lettura idanagrafica cliente e percentuale di sconto/rincaro in base al listino
$rs = $dbo->fetchArray('SELECT idanagrafica FROM co_contratti WHERE id='.prepare($id_record));

View File

@ -156,7 +156,7 @@ if (empty($new_codice)) {
</div>
<div class="col-md-4" id='impianti'>
{[ "type": "select", "label": "<?php echo tr('Impianto'); ?>", "multiple": 1, "name": "idimpianti[]", "value": "<?php echo $idimpianto; ?>", "placeholder": "<?php echo tr('Seleziona prima un cliente'); ?>...", "ajax-source": "impianti", "icon-after": "add|<?php echo Modules::get('MyImpianti')['id']; ?>|source=Attività|<?php echo (empty($idimpianto)) ? '' : 'disabled'; ?>", "data-heavy": 0 ]}
{[ "type": "select", "label": "<?php echo tr('Impianto'); ?>", "multiple": 1, "name": "idimpianti[]", "value": "<?php echo $idimpianto; ?>", "placeholder": "<?php echo tr('Seleziona prima un cliente'); ?>...", "ajax-source": "impianti-cliente", "icon-after": "add|<?php echo Modules::get('MyImpianti')['id']; ?>|source=Attività|<?php echo (empty($idimpianto)) ? '' : 'disabled'; ?>", "data-heavy": 0 ]}
</div>
</div>

View File

@ -111,7 +111,7 @@ echo '
// Impianto
echo '
<div class="col-md-4">
{[ "type": "select", "label": "'.tr('Impianto su cui installare').'", "name": "idimpianto", "value": "'.$idimpianto.'", "ajax-source": "impianti" ]}
{[ "type": "select", "label": "'.tr('Impianto su cui installare').'", "name": "idimpianto", "value": "'.$idimpianto.'", "ajax-source": "impianti-intervento" ]}
</div>
</div>';

View File

@ -4,6 +4,19 @@ include_once __DIR__.'/../../../core.php';
switch ($resource) {
case 'impianti':
$query = 'SELECT id, CONCAT(matricola, " - ", nome) AS descrizione FROM my_impianti |where| ORDER BY id, idanagrafica';
foreach ($elements as $element) {
$filter[] = 'id='.prepare($element);
}
if (!empty($search)) {
$search_fields[] = 'nome LIKE '.prepare('%'.$search.'%');
$search_fields[] = 'matricola LIKE '.prepare('%'.$search.'%');
}
break;
case 'impianti-cliente':
if (isset($superselect['idanagrafica'])) {
$query = 'SELECT id, CONCAT(matricola, " - ", nome) AS descrizione FROM my_impianti |where| ORDER BY idsede';
@ -19,7 +32,10 @@ switch ($resource) {
$search_fields[] = 'matricola LIKE '.prepare('%'.$search.'%');
}
}
elseif( isset($superselect['idintervento']) ){
break;
case 'impianti-intervento':
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) {