2018-03-28 17:04:10 +02:00
|
|
|
<?php
|
2020-09-07 15:04:06 +02:00
|
|
|
/*
|
|
|
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
|
|
|
* Copyright (C) DevCode s.n.c.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2018-03-28 17:04:10 +02:00
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
switch (filter('op')) {
|
|
|
|
case 'update':
|
|
|
|
$nome = filter('nome');
|
|
|
|
|
|
|
|
if (isset($nome)) {
|
2018-06-26 14:30:26 +02:00
|
|
|
$array = [
|
|
|
|
'nome' => $nome,
|
2018-07-19 15:33:32 +02:00
|
|
|
'filiale' => post('filiale'),
|
|
|
|
'iban' => post('iban'),
|
|
|
|
'bic' => post('bic'),
|
|
|
|
'id_pianodeiconti3' => post('id_pianodeiconti3'),
|
|
|
|
'note' => post('note'),
|
2018-06-26 14:30:26 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
if (!empty($id_record)) {
|
|
|
|
$dbo->update('co_banche', $array, ['id' => $id_record]);
|
|
|
|
}
|
|
|
|
|
2018-12-28 00:04:41 +01:00
|
|
|
flash()->info(tr('Salvataggio completato.'));
|
2018-03-28 17:04:10 +02:00
|
|
|
} else {
|
2018-07-19 17:29:21 +02:00
|
|
|
flash()->error(tr('Ci sono stati alcuni errori durante il salvataggio!'));
|
2018-03-28 17:04:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'add':
|
|
|
|
$nome = filter('nome');
|
2018-12-28 08:07:56 +01:00
|
|
|
$bic = filter('bic');
|
|
|
|
$iban = filter('iban');
|
2018-03-28 17:04:10 +02:00
|
|
|
|
|
|
|
if (isset($nome)) {
|
2018-12-28 00:04:41 +01:00
|
|
|
$dbo->query('INSERT INTO `co_banche` (`nome`, `bic`, `iban`) VALUES ('.prepare($nome).', '.prepare($bic).', '.prepare($iban).')');
|
2018-03-28 17:04:10 +02:00
|
|
|
$id_record = $dbo->lastInsertedID();
|
2018-06-26 14:30:26 +02:00
|
|
|
|
|
|
|
if (isAjaxRequest()) {
|
|
|
|
echo json_encode(['id' => $id_record, 'text' => $nome]);
|
|
|
|
}
|
|
|
|
|
2018-07-19 17:29:21 +02:00
|
|
|
flash()->info(tr('Aggiunta nuova _TYPE_', [
|
2018-03-28 17:04:10 +02:00
|
|
|
'_TYPE_' => 'banca',
|
2018-07-07 13:56:22 +02:00
|
|
|
]));
|
2018-03-28 17:04:10 +02:00
|
|
|
} else {
|
2018-07-19 17:29:21 +02:00
|
|
|
flash()->error(tr('Ci sono stati alcuni errori durante il salvataggio!'));
|
2018-03-28 17:04:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'delete':
|
2018-09-20 16:12:34 +02:00
|
|
|
$dbo->update('co_banche', [
|
|
|
|
'deleted_at' => date('Y-m-d H:i:s'),
|
|
|
|
], ['id' => $id_record]);
|
2018-06-26 14:30:26 +02:00
|
|
|
|
2018-09-20 16:12:34 +02:00
|
|
|
flash()->info(tr('_TYPE_ eliminata con successo!', [
|
|
|
|
'_TYPE_' => 'Banca',
|
|
|
|
]));
|
2018-03-28 17:04:10 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|