openstamanager/plugins/sedi/actions.php

64 lines
1.9 KiB
PHP
Raw Normal View History

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