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
|
|
|
|
2020-09-09 16:55:45 +02:00
|
|
|
use Modules\Anagrafiche\Anagrafica;
|
|
|
|
use Modules\Banche\Banca;
|
|
|
|
|
2018-03-28 17:04:10 +02:00
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
switch (filter('op')) {
|
2020-09-09 16:55:45 +02:00
|
|
|
case 'add':
|
|
|
|
$id_anagrafica = filter('id_anagrafica');
|
|
|
|
$anagrafica = Anagrafica::find($id_anagrafica);
|
|
|
|
|
2018-03-28 17:04:10 +02:00
|
|
|
$nome = filter('nome');
|
2020-09-09 16:55:45 +02:00
|
|
|
$iban = filter('iban');
|
|
|
|
$bic = filter('bic');
|
2018-03-28 17:04:10 +02:00
|
|
|
|
2020-09-09 16:55:45 +02:00
|
|
|
$banca = Banca::build($anagrafica, $nome, $iban, $bic);
|
|
|
|
$id_record = $banca->id;
|
|
|
|
|
|
|
|
if (isAjaxRequest()) {
|
|
|
|
echo json_encode([
|
|
|
|
'id' => $id_record,
|
|
|
|
'text' => $nome,
|
|
|
|
]);
|
2018-03-28 17:04:10 +02:00
|
|
|
}
|
|
|
|
|
2020-09-09 16:55:45 +02:00
|
|
|
flash()->info(tr('Aggiunta nuova _TYPE_', [
|
|
|
|
'_TYPE_' => 'banca',
|
|
|
|
]));
|
|
|
|
|
2018-03-28 17:04:10 +02:00
|
|
|
break;
|
|
|
|
|
2020-09-09 16:55:45 +02:00
|
|
|
case 'update':
|
2018-03-28 17:04:10 +02:00
|
|
|
$nome = filter('nome');
|
|
|
|
|
2020-09-09 16:55:45 +02:00
|
|
|
$banca->nome = post('nome');
|
|
|
|
$banca->iban = post('iban');
|
|
|
|
$banca->bic = post('bic');
|
2018-06-26 14:30:26 +02:00
|
|
|
|
2020-09-09 16:55:45 +02:00
|
|
|
$banca->note = post('note');
|
|
|
|
$banca->id_pianodeiconti3 = post('id_pianodeiconti3');
|
|
|
|
$banca->filiale = post('filiale');
|
2020-09-24 17:27:33 +02:00
|
|
|
$banca->creditor_id = post('creditor_id');
|
2020-10-02 17:25:26 +02:00
|
|
|
$banca->codice_sia = post('codice_sia');
|
2018-06-26 14:30:26 +02:00
|
|
|
|
2020-09-24 16:41:43 +02:00
|
|
|
$banca->predefined = post('predefined');
|
|
|
|
|
2020-09-09 16:55:45 +02:00
|
|
|
$banca->save();
|
|
|
|
|
|
|
|
flash()->info(tr('Salvataggio completato'));
|
2018-03-28 17:04:10 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'delete':
|
2020-09-09 16:55:45 +02:00
|
|
|
$banca->delete();
|
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;
|
|
|
|
}
|