Fix eliminazione interventi da bulk

This commit is contained in:
Pek5892 2023-03-20 12:52:13 +01:00
parent 83caca7c8e
commit a8644fe16b
1 changed files with 21 additions and 1 deletions

View File

@ -271,7 +271,26 @@ switch (post('op')) {
foreach ($id_records as $id) { foreach ($id_records as $id) {
$intervento = Intervento::find($id); $intervento = Intervento::find($id);
try { try {
$intervento->delete(); // Eliminazione associazioni tra interventi e contratti
$dbo->query('UPDATE co_promemoria SET idintervento = NULL WHERE idintervento='.prepare($id_record));
$intervento->delete();
// Elimino il collegamento al componente
$dbo->query('DELETE FROM my_componenti WHERE id_intervento='.prepare($id_record));
// Eliminazione associazione tecnici collegati all'intervento
$dbo->query('DELETE FROM in_interventi_tecnici WHERE idintervento='.prepare($id_record));
// Eliminazione associazione interventi e my_impianti
$dbo->query('DELETE FROM my_impianti_interventi WHERE idintervento='.prepare($id_record));
// Elimino anche eventuali file caricati
Uploads::deleteLinked([
'id_module' => $id_module,
'id_record' => $id_record,
]);
} catch (InvalidArgumentException $e) { } catch (InvalidArgumentException $e) {
} }
} }
@ -280,6 +299,7 @@ switch (post('op')) {
break; break;
case 'stampa-riepilogo': case 'stampa-riepilogo':
$_SESSION['superselect']['interventi'] = $id_records; $_SESSION['superselect']['interventi'] = $id_records;
$id_print = Prints::getPrints()['Riepilogo interventi']; $id_print = Prints::getPrints()['Riepilogo interventi'];