diff --git a/templates/interventi/body.php b/templates/interventi/body.php index 70fa2d888..1936dc562 100755 --- a/templates/interventi/body.php +++ b/templates/interventi/body.php @@ -19,6 +19,7 @@ use Carbon\Carbon; use Models\Module; +use Modules\Checklists\Check; include_once __DIR__.'/../../core.php'; @@ -546,7 +547,23 @@ if ($options['checklist']) { echo renderChecklistHtml($check); } - echo ' + $impianti_collegati = $dbo->fetchArray('SELECT * FROM my_impianti_interventi INNER JOIN my_impianti ON my_impianti_interventi.idimpianto = my_impianti.id WHERE idintervento = '.prepare($id_record)); + foreach ($impianti_collegati as $impianto) { + $checks = Check::where('id_module_from', (new Module())->getByField('name', 'Impianti', Models\Locale::getPredefined()->id))->where('id_record_from', $impianto['id'])->where('id_module', (new Module())->getByField('name', 'Interventi', Models\Locale::getPredefined()->id))->where('id_record', $id_record)->where('id_parent', null)->get(); + + if (sizeof($checks)) { + echo ' + + + '.tr('Impianto', [], ['upper' => true]).' '.$impianto['matricola'].' - '.$impianto['nome'].' + + '; + foreach ($checks as $check) { + echo renderChecklistHtml($check); + } + } + } + echo ' '; } }