1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-11 16:06:20 +01:00
openstamanager/plugins/assicurazione_crediti/actions.php

54 lines
1.8 KiB
PHP
Raw Normal View History

2024-04-24 12:18:53 +02:00
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* 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/>.
*/
use Modules\Anagrafiche\Anagrafica;
use Plugins\AssicurazioneCrediti\AssicurazioneCrediti;
include_once __DIR__.'/../../core.php';
$operazione = filter('op');
switch ($operazione) {
case 'add':
$anagrafica = Anagrafica::find($id_parent);
$assicurazione_crediti = AssicurazioneCrediti::build($anagrafica, post('fido_assicurato'), post('data_inizio'), post('data_fine'));
$assicurazione_crediti->save();
2024-04-24 12:26:51 +02:00
flash()->info(tr('Assicurazione crediti aggiunta!'));
2024-04-24 12:18:53 +02:00
break;
case 'update':
$assicurazione_crediti->data_inizio = post('data_inizio');
$assicurazione_crediti->data_fine = post('data_fine');
$assicurazione_crediti->fido_assicurato = post('fido_assicurato');
$assicurazione_crediti->save();
2024-04-24 12:26:51 +02:00
flash()->info(tr('Assicurazione crediti aggiornata!'));
2024-04-24 12:18:53 +02:00
break;
case 'delete':
$assicurazione_crediti->delete();
2024-04-24 12:26:51 +02:00
flash()->info(tr('Assicurazione crediti eliminata!'));
2024-04-24 12:18:53 +02:00
break;
}