2017-08-04 16:28:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
$operazione = filter('op');
|
|
|
|
|
|
|
|
switch ($operazione) {
|
|
|
|
case 'addsede':
|
2018-02-15 17:30:42 +01:00
|
|
|
$dbo->insert('an_sedi', [
|
2017-08-04 16:28:16 +02:00
|
|
|
'idanagrafica' => $id_parent,
|
2018-07-19 15:33:32 +02:00
|
|
|
'nomesede' => post('nomesede'),
|
|
|
|
'indirizzo' => post('indirizzo'),
|
|
|
|
'indirizzo2' => post('indirizzo2'),
|
|
|
|
'citta' => post('citta'),
|
|
|
|
'cap' => post('cap'),
|
|
|
|
'km' => post('km'),
|
|
|
|
'cellulare' => post('cellulare'),
|
|
|
|
'telefono' => post('telefono'),
|
|
|
|
'email' => post('email'),
|
|
|
|
'idzona' => post('idzona'),
|
2018-02-15 17:30:42 +01:00
|
|
|
]);
|
|
|
|
$id_record = $dbo->lastInsertedID();
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2018-07-19 17:29:21 +02:00
|
|
|
flash()->info(tr('Aggiunta una nuova sede!'));
|
2017-08-04 16:28:16 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'updatesede':
|
|
|
|
$array = [
|
2018-07-19 15:33:32 +02:00
|
|
|
'nomesede' => post('nomesede'),
|
|
|
|
'indirizzo' => post('indirizzo'),
|
|
|
|
'indirizzo2' => post('indirizzo2'),
|
|
|
|
'piva' => post('piva'),
|
|
|
|
'codice_fiscale' => post('codice_fiscale'),
|
|
|
|
'citta' => post('citta'),
|
|
|
|
'cap' => post('cap'),
|
|
|
|
'provincia' => post('provincia'),
|
|
|
|
'km' => post('km'),
|
|
|
|
'cellulare' => post('cellulare'),
|
|
|
|
'telefono' => post('telefono'),
|
|
|
|
'email' => post('email'),
|
|
|
|
'fax' => post('fax'),
|
|
|
|
'id_nazione' => !empty(post('id_nazione')) ? post('id_nazione') : null,
|
|
|
|
'idzona' => post('idzona'),
|
|
|
|
'gaddress' => post('gaddress'),
|
|
|
|
'lat' => post('lat'),
|
|
|
|
'lng' => post('lng'),
|
2017-08-04 16:28:16 +02:00
|
|
|
];
|
|
|
|
|
2017-09-18 16:55:19 +02:00
|
|
|
$dbo->update('an_sedi', $array, ['id' => $id_record]);
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2018-07-19 17:29:21 +02:00
|
|
|
flash()->info(tr('Salvataggio completato!'));
|
2017-08-04 16:28:16 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'deletesede':
|
2018-02-15 17:30:42 +01:00
|
|
|
$dbo->query('DELETE FROM `an_sedi` WHERE `id`='.prepare($id_record));
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2018-07-19 17:29:21 +02:00
|
|
|
flash()->info(tr('Sede eliminata!'));
|
2017-08-04 16:28:16 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|