2018-05-04 17:57:46 +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-05-04 17:57:46 +02:00
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
switch (post('op')) {
|
|
|
|
case 'add':
|
|
|
|
$idmastrino = get_new_idmastrino('co_movimenti_modelli');
|
|
|
|
$descrizione = post('descrizione');
|
2019-04-11 16:04:08 +02:00
|
|
|
$nome = post('nome');
|
2018-05-04 17:57:46 +02:00
|
|
|
|
2018-07-19 15:33:32 +02:00
|
|
|
for ($i = 0; $i < sizeof(post('idconto')); ++$i) {
|
2018-05-04 17:57:46 +02:00
|
|
|
$idconto = post('idconto')[$i];
|
2019-04-12 01:11:32 +02:00
|
|
|
if (!empty($idconto)) {
|
2019-04-11 16:04:08 +02:00
|
|
|
$query = 'INSERT INTO co_movimenti_modelli(idmastrino, nome, descrizione, idconto) VALUES('.prepare($idmastrino).', '.prepare($nome).', '.prepare($descrizione).', '.prepare($idconto).')';
|
|
|
|
if ($dbo->query($query)) {
|
|
|
|
$id_record = $idmastrino;
|
|
|
|
}
|
2018-05-04 17:57:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'editriga':
|
|
|
|
$idmastrino = post('idmastrino');
|
|
|
|
$descrizione = post('descrizione');
|
2019-04-11 16:04:08 +02:00
|
|
|
$nome = post('nome');
|
2018-05-04 17:57:46 +02:00
|
|
|
|
|
|
|
// Eliminazione prima nota
|
|
|
|
$dbo->query('DELETE FROM co_movimenti_modelli WHERE idmastrino='.prepare($idmastrino));
|
|
|
|
|
2018-07-19 15:33:32 +02:00
|
|
|
for ($i = 0; $i < sizeof(post('idconto')); ++$i) {
|
2018-05-04 17:57:46 +02:00
|
|
|
$idconto = post('idconto')[$i];
|
2019-04-12 01:11:32 +02:00
|
|
|
if (!empty($idconto)) {
|
|
|
|
$query = 'INSERT INTO co_movimenti_modelli(idmastrino, nome, descrizione, idconto) VALUES('.prepare($idmastrino).', '.prepare($nome).', '.prepare($descrizione).', '.prepare($idconto).')';
|
2019-04-11 16:04:08 +02:00
|
|
|
if ($dbo->query($query)) {
|
|
|
|
$id_record = $idmastrino;
|
|
|
|
}
|
2018-05-04 17:57:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'delete':
|
|
|
|
$idmastrino = post('idmastrino');
|
|
|
|
|
2018-05-11 15:56:08 +02:00
|
|
|
if (!empty($idmastrino)) {
|
2018-05-04 17:57:46 +02:00
|
|
|
// Eliminazione prima nota
|
|
|
|
$dbo->query('DELETE FROM co_movimenti_modelli WHERE idmastrino='.prepare($idmastrino));
|
|
|
|
|
2018-07-19 17:29:21 +02:00
|
|
|
flash()->info(tr('Movimento eliminato!'));
|
2018-05-04 17:57:46 +02:00
|
|
|
}
|
2018-05-11 15:56:08 +02:00
|
|
|
|
2018-05-04 17:57:46 +02:00
|
|
|
break;
|
|
|
|
}
|