Gestione eliminazione causali DDT

This commit is contained in:
Beppe 2021-09-08 12:33:57 +02:00
parent eac47e1c84
commit b7016ddbeb
3 changed files with 17 additions and 5 deletions

View File

@ -84,12 +84,15 @@ switch (filter('op')) {
if (isset($id_record) && empty($documenti)) {
$dbo->query('DELETE FROM `dt_causalet` WHERE `id`='.prepare($id_record));
flash()->info(tr('Tipologia di _TYPE_ eliminata con successo.', [
'_TYPE_' => 'causale',
]));
} else {
flash()->error(tr('Sono presenti dei documenti collegati a questa causale'));
$dbo->update('dt_causalet',[
'deleted_at' => date("Y-m-d H:i:s"),
],['id' => $id_record]);
}
flash()->info(tr('Tipologia di _TYPE_ eliminata con successo.', [
'_TYPE_' => 'causale',
]));
break;
}

View File

@ -26,6 +26,9 @@ switch ($resource) {
foreach ($elements as $element) {
$filter[] = 'id='.prepare($element);
}
if (empty($filter)) {
$where[] = 'dt_causalet.deleted_at IS NULL';
}
if (!empty($search)) {
$search_fields[] = 'descrizione LIKE '.prepare('%'.$search.'%');
}

View File

@ -92,3 +92,9 @@ UPDATE `zz_plugins` SET `default` = 1, `version` = '' WHERE `zz_plugins`.`name`
-- Escludo dalla lista movimenti quelli collegati ad articoli eliminati
UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM `mg_movimenti` JOIN `mg_articoli` ON `mg_articoli`.id = `mg_movimenti`.`idarticolo` LEFT JOIN `an_sedi` ON `mg_movimenti`.`idsede` = `an_sedi`.`id` WHERE 1=1 AND mg_articoli.deleted_at IS NULL HAVING 2=2 ORDER BY mg_movimenti.data DESC, mg_movimenti.created_at DESC' WHERE `zz_modules`.`name` = 'Movimenti';
-- Aggiunta eliminazione causale DDT
ALTER TABLE `dt_causalet` ADD `deleted_at` TIMESTAMP NULL AFTER `updated_at`;
-- Modifico il filtro del modulo
UPDATE `zz_modules` SET `options2` = 'SELECT |select| FROM `dt_causalet` WHERE 1=1 AND `deleted_at` IS NULL HAVING 2=2' WHERE `zz_modules`.`name` = 'Causali';