mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-03 01:08:08 +01:00
Fix checks impianti parent
This commit is contained in:
parent
54f9c58c63
commit
2b0c5f886e
@ -89,7 +89,12 @@ switch (filter('op')) {
|
||||
'id_record' => $impianto['id'],
|
||||
]);
|
||||
foreach ($checks_categoria as $check_categoria) {
|
||||
$check = Check::build($user, $structure, $impianto['id'], $check_categoria['content'], null, $check_categoria['is_titolo'], $check_categoria['order']);
|
||||
$id_parent_new = null;
|
||||
if ($check_categoria['id_parent']) {
|
||||
$parent = $dbo->selectOne('zz_checks', '*', ['id' => $check_categoria['id_parent']]);
|
||||
$id_parent_new = $dbo->selectOne('zz_checks', '*', ['content' => $parent['content'], 'id_module' => $modulo_impianti['id'], 'id_record' => $impianto['id']])['id'];
|
||||
}
|
||||
$check = Check::build($user, $structure, $impianto['id'], $check_categoria['content'], $id_parent_new, $check_categoria['is_titolo'], $check_categoria['order']);
|
||||
$check->id_module = $modulo_impianti['id'];
|
||||
$check->id_plugin = null;
|
||||
$check->note = $check_categoria['note'];
|
||||
|
@ -102,13 +102,26 @@ switch ($op) {
|
||||
$id_categoria = post('id_categoria');
|
||||
|
||||
if (!empty($matricola)) {
|
||||
$dbo->query('INSERT INTO my_impianti(matricola, idanagrafica, nome, data, idtecnico, idsede, id_categoria) VALUES ('.prepare($matricola).', '.prepare($idanagrafica).', '.prepare($nome).', NOW(), '.prepare($idtecnico).', '.prepare($idsede).', '.prepare($id_categoria).')');
|
||||
$dbo->insert('my_impianti', [
|
||||
'matricola' => $matricola,
|
||||
'idanagrafica' => $idanagrafica,
|
||||
'nome' => $nome,
|
||||
'data' => date('Y-m-d'),
|
||||
'idtecnico' => $idtecnico ?: 0,
|
||||
'idsede' => $idsede ?: 0,
|
||||
'id_categoria' => $id_categoria ?: null
|
||||
]);
|
||||
|
||||
$id_record = $dbo->lastInsertedID();
|
||||
|
||||
$checks_categoria = $dbo->fetchArray('SELECT * FROM zz_checks WHERE id_module = '.prepare($modulo_categorie_impianti['id']).' AND id_record = '.prepare($id_categoria));
|
||||
foreach ($checks_categoria as $check_categoria) {
|
||||
$check = Check::build($user, $structure, $id_record, $check_categoria['content'], null, $check_categoria['is_titolo'], $check_categoria['order']);
|
||||
$id_parent_new = null;
|
||||
if ($check_categoria['id_parent']) {
|
||||
$parent = $dbo->selectOne('zz_checks', '*', ['id' => $check_categoria['id_parent']]);
|
||||
$id_parent_new = $dbo->selectOne('zz_checks', '*', ['content' => $parent['content'], 'id_module' => $id_module, 'id_record' => $id_record])['id'];
|
||||
}
|
||||
$check = Check::build($user, $structure, $id_record, $check_categoria['content'], $id_parent_new, $check_categoria['is_titolo'], $check_categoria['order']);
|
||||
$check->id_plugin = null;
|
||||
$check->note = $check_categoria['note'];
|
||||
$check->save();
|
||||
@ -174,7 +187,12 @@ switch ($op) {
|
||||
|
||||
$checks_categoria = $dbo->fetchArray('SELECT * FROM zz_checks WHERE id_module = '.prepare($modulo_categorie_impianti['id']).' AND id_record = '.prepare(post('id_categoria')));
|
||||
foreach ($checks_categoria as $check_categoria) {
|
||||
$check = Check::build($user, $structure, $id_record, $check_categoria['content'], null, $check_categoria['is_titolo'], $check_categoria['order']);
|
||||
$id_parent_new = null;
|
||||
if ($check_categoria['id_parent']) {
|
||||
$parent = $dbo->selectOne('zz_checks', '*', ['id' => $check_categoria['id_parent']]);
|
||||
$id_parent_new = $dbo->selectOne('zz_checks', '*', ['content' => $parent['content'], 'id_module' => $id_module, 'id_record' => $id_record])['id'];
|
||||
}
|
||||
$check = Check::build($user, $structure, $id_record, $check_categoria['content'], $id_parent_new, $check_categoria['is_titolo'], $check_categoria['order']);
|
||||
$check->id_plugin = null;
|
||||
$check->note = $check_categoria['note'];
|
||||
$check->save();
|
||||
|
@ -56,9 +56,14 @@ if (filter('op') == 'link_impianti') {
|
||||
|
||||
$checks_impianti = $dbo->fetchArray('SELECT * FROM zz_checks WHERE id_module = '.prepare( $modulo_impianti['id']).' AND id_record = '.prepare($matricola));
|
||||
foreach ($checks_impianti as $check_impianto) {
|
||||
$check = Check::build($user, $structure, $id_record, $check_impianto['content'], null, $check_impianto['is_titolo'], $check_impianto['order'], $modulo_impianti['id'], $matricola);
|
||||
$id_parent_new = null;
|
||||
if ($check_impianto['id_parent']) {
|
||||
$parent = $dbo->selectOne('zz_checks', '*', ['id' => $check_impianto['id_parent']]);
|
||||
$id_parent_new = $dbo->selectOne('zz_checks', '*', ['content' => $parent['content'], 'id_module' => $id_module, 'id_record' => $id_record])['id'];
|
||||
}
|
||||
$check = Check::build($user, $structure, $id_record, $check_impianto['content'], $id_parent_new, $check_impianto['is_titolo'], $check_impianto['order'], $modulo_impianti['id'], $matricola);
|
||||
$check->id_module = $id_module;
|
||||
$check->id_plugin = null;
|
||||
$check->id_plugin = $id_plugin;
|
||||
$check->note = $check_impianto['note'];
|
||||
$check->save();
|
||||
}
|
||||
@ -138,7 +143,7 @@ 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', $modulo_impianti['id'])->where('id_record_from', $impianto['id'])->where('id_module', $id_module)->where('id_record', $id_record)->get();
|
||||
$checks = Check::where('id_module_from', $modulo_impianti['id'])->where('id_record_from', $impianto['id'])->where('id_module', $id_module)->where('id_record', $id_record)->where('id_parent', null)->get();
|
||||
|
||||
$type = 'muted';
|
||||
$class = 'disabled';
|
||||
@ -179,7 +184,7 @@ echo '
|
||||
</tr>
|
||||
|
||||
<tr style="display: none">
|
||||
<td colspan="6">
|
||||
<td colspan="7">
|
||||
<table class="table">
|
||||
<tbody class="sort check-impianto" data-sonof="0">';
|
||||
foreach ($checks as $check) {
|
||||
|
@ -20,6 +20,7 @@
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
use Carbon\CarbonPeriod;
|
||||
use Models\Plugin;
|
||||
use Modules\Anagrafiche\Anagrafica;
|
||||
use Modules\Articoli\Articolo as ArticoloOriginale;
|
||||
use Modules\Checklists\Check;
|
||||
@ -39,6 +40,7 @@ use Plugins\ListinoClienti\DettaglioPrezzo;
|
||||
use Plugins\PianificazioneInterventi\Promemoria;
|
||||
|
||||
$modulo_impianti = Modules::get('Impianti');
|
||||
$plugin_impianti = Plugin::pool('Impianti');
|
||||
|
||||
switch (post('op')) {
|
||||
case 'update':
|
||||
@ -233,9 +235,14 @@ switch (post('op')) {
|
||||
|
||||
$checks_impianti = $dbo->fetchArray('SELECT * FROM zz_checks WHERE id_module = '.prepare( $modulo_impianti['id']).' AND id_record = '.prepare($impianto));
|
||||
foreach ($checks_impianti as $check_impianto) {
|
||||
$check = Check::build($user, $structure, $id_record, $check_impianto['content'], null, $check_impianto['is_titolo'], $check_impianto['order'], $modulo_impianti['id'], $impianto);
|
||||
$id_parent_new = null;
|
||||
if ($check_impianto['id_parent']) {
|
||||
$parent = $dbo->selectOne('zz_checks', '*', ['id' => $check_impianto['id_parent']]);
|
||||
$id_parent_new = $dbo->selectOne('zz_checks', '*', ['content' => $parent['content'], 'id_module' => $id_module, 'id_record' => $id_record])['id'];
|
||||
}
|
||||
$check = Check::build($user, $structure, $id_record, $check_impianto['content'], $id_parent_new, $check_impianto['is_titolo'], $check_impianto['order'], $modulo_impianti['id'], $impianto);
|
||||
$check->id_module = $id_module;
|
||||
$check->id_plugin = null;
|
||||
$check->id_plugin = $plugin_impianti['id'];
|
||||
$check->note = $check_impianto['note'];
|
||||
$check->save();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user