1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-23 13:58:25 +01:00

miglioria aggiunta impianti da plugin interventi

This commit is contained in:
Beppe 2019-05-17 09:58:59 +02:00
parent db9e73a666
commit 431649023b
3 changed files with 4 additions and 28 deletions

View File

@ -186,31 +186,6 @@ switch (post('op')) {
break;
// Aggiungo impianto
case 'add_impianto':
$matricola = post('matricola');
$idanagrafica = post('idanagrafica');
$nome = post('nome');
$idtecnico = post('idtecnico');
if (!empty($matricola)) {
$dbo->query('INSERT INTO my_impianti(matricola, idanagrafica, nome, data, idtecnico) VALUES ('.prepare($matricola).', '.prepare($idanagrafica).', '.prepare($nome).', NOW(), '.prepare($idtecnico).')');
$id_impianto = $dbo->lastInsertedID();
$dbo->insert('my_impianti_interventi', [
'idintervento' => $id_record,
'idimpianto' => $id_impianto,
]);
flash()->info(tr('Aggiunto nuovo impianto!'));
$database->commitTransaction();
header('location: '.$rootdir.'/editor.php?id_module=3&id_record='.$id_record.'#tab_2');
exit;
}
break;
// Eliminazione intervento
case 'delete':

View File

@ -10,7 +10,7 @@ if ($source == 'Attività') {
}
?><form action="" method="post" id="add-form">
<input type="hidden" name="op" value="<?php echo get('plugin') == 1 ? 'add_impianto' : 'add'; ?>">
<input type="hidden" name="op" value="add">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="source" value="<?php echo $source; ?>">

View File

@ -176,13 +176,14 @@ echo '
<input type="hidden" name="backto" value="record-edit">
<div class="row">
<div class="col-xs-12 col-md-6">
{[ "type": "select", "name": "matricole[]", "multiple": 1, "value": "'.implode(',', $impianti).'", "values": "query=SELECT my_impianti.id, CONCAT(matricola, \' - \', nome) AS descrizione, CONCAT(nomesede, IF(citta IS NULL OR citta = \'\', \'\', CONCAT(\' (\', citta, \')\'))) AS optgroup FROM my_impianti JOIN (SELECT id, nomesede, citta FROM an_sedi UNION SELECT 0 AS id, \'Sede legale\' AS nomesede, \'\' AS citta) AS t ON t.id = my_impianti.idsede WHERE idanagrafica='.prepare($record['idanagrafica']).' ORDER BY idsede ASC, matricola ASC", "extra": "'.$readonly.'" ]}
{[ "type": "select", "name": "matricole[]", "multiple": 1, "value": "'.implode(',', $impianti).'", "ajax-source": "impianti-cliente", "extra": "'.$readonly.'" ]}
</div>
</div>
<br><br>
<button type="submit" class="btn btn-success" '.$disabled.'><i class="fa fa-check"></i> '.tr('Salva impianti').'</button>
<button type="button" class="btn btn-primary" data-toggle="modal" data-title="'.tr('Aggiungi impianto').'" data-href="'.$rootdir.'/modules/my_impianti/add.php?id_module='.Modules::get('MyImpianti')['id'].'&id_record='.$id_record.'&source=Attività&plugin=1"><i class="fa fa-plus"></i> '.tr('Aggiungi impianto').'</button>
<button type="button" class="btn btn-primary" data-toggle="modal" data-title="'.tr('Aggiungi impianto').'" data-href="'.$rootdir.'/add.php?id_module='.Modules::get('MyImpianti')['id'].'&source=Attività&select=idimpianti&ajax=yes" data-target="#bs-popup2"><i class="fa fa-plus"></i> '.tr('Aggiungi impianto').'</button>
</form>';
echo '