2017-09-18 16:55:19 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
$operazione = filter('op');
|
|
|
|
|
|
|
|
switch ($operazione) {
|
|
|
|
case 'addreferente':
|
2018-02-15 17:30:42 +01:00
|
|
|
$dbo->insert('an_referenti', [
|
|
|
|
'idanagrafica' => $id_parent,
|
|
|
|
'nome' => $post['nome'],
|
|
|
|
'mansione' => $post['mansione'],
|
|
|
|
'telefono' => $post['telefono'],
|
|
|
|
'email' => $post['email'],
|
|
|
|
'idsede' => $post['idsede'],
|
|
|
|
]);
|
|
|
|
$id_record = $dbo->lastInsertedID();
|
|
|
|
|
2018-07-07 13:56:22 +02:00
|
|
|
App::flash()->info(tr('Aggiunto nuovo referente!'));
|
2017-09-18 16:55:19 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'updatereferente':
|
2018-02-15 17:30:42 +01:00
|
|
|
$dbo->update('an_referenti', [
|
|
|
|
'idanagrafica' => $id_parent,
|
|
|
|
'nome' => $post['nome'],
|
|
|
|
'mansione' => $post['mansione'],
|
|
|
|
'telefono' => $post['telefono'],
|
|
|
|
'email' => $post['email'],
|
|
|
|
'idsede' => $post['idsede'],
|
|
|
|
], ['id' => $id_record]);
|
2017-09-18 16:55:19 +02:00
|
|
|
|
2018-07-07 13:56:22 +02:00
|
|
|
App::flash()->info(tr('Salvataggio completato!'));
|
2017-09-18 16:55:19 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'deletereferente':
|
2018-02-15 17:30:42 +01:00
|
|
|
$dbo->query('DELETE FROM `an_referenti` WHERE `id`='.prepare($id_record));
|
2017-09-18 16:55:19 +02:00
|
|
|
|
2018-07-07 13:56:22 +02:00
|
|
|
App::flash()->info(tr('Referente eliminato!'));
|
2017-09-18 16:55:19 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|