Correzione del funzionamento della stampa di riepilogo interventi

This commit is contained in:
Thomas Zilio 2017-09-21 18:04:57 +02:00
parent 2b3bd9344b
commit 083dc25b8e
2 changed files with 13 additions and 32 deletions

View File

@ -89,10 +89,9 @@ class Widgets
$dato = ''; $dato = '';
if ($query != '') { if ($query != '') {
$dato = $dbo->fetchArray($query); $dato = $dbo->fetchArray($query);
}
if (!empty($dato)) {
$dato = $dato[0]['dato']; $dato = $dato[0]['dato'];
}
// inserisco il widget // inserisco il widget
$result .= ' $result .= '
@ -131,11 +130,10 @@ class Widgets
if (!empty($results[0]['more_link'])) { if (!empty($results[0]['more_link'])) {
$result .= ' $result .= '
</a>'; </a>';
}
$result .= ' $result .= '
</li>'; </li>';
} }
break; break;

View File

@ -2,31 +2,16 @@
include_once __DIR__.'/../../core.php'; include_once __DIR__.'/../../core.php';
$module_name = 'Interventi'; $module = Modules::getModule('Interventi');
$id_module = $module['id'];
$id_module = $_GET['id_module']; $total = Modules::getQuery($id_module);
$fields = []; // Lettura parametri modulo
$select = '*'; $module_query = $total['query'];
$datas = $dbo->fetchArray('SELECT * FROM zz_views WHERE id_module='.$id_module.' AND id IN (SELECT id_vista FROM zz_group_view WHERE id_gruppo=(SELECT idgruppo FROM zz_users WHERE id='.$_SESSION['id_utente'].')) ORDER BY `order` ASC');
if ($datas != null) {
$select = '';
foreach ($datas as $data) {
$select .= $data['query']." AS '".$data['name']."',";
if ($data['enabled']) {
array_push($fields, trim($data['name']));
}
}
$select = substr($select, 0, strlen($select) - 1);
}
$module = $dbo->fetchArray('SELECT * FROM zz_modules WHERE id="'.$id_module.'"')[0];
$module_query = ($module['options2'] != '') ? $module['options2'] : $module['options'];
$module_query = str_replace('|select|', $select, $module_query);
$module_query = str_replace('|period_start|', $_SESSION['period_start'], $module_query); $module_query = str_replace('|period_start|', $_SESSION['period_start'], $module_query);
$module_query = str_replace('|period_end|', $_SESSION['period_end'], $module_query); $module_query = str_replace('|period_end|', $_SESSION['period_end'], $module_query);
$module_dir = $module['directory']; $module_query = str_replace('|select|', $total['select'], $module_query);
$search_filters = []; $search_filters = [];
@ -40,14 +25,12 @@ if (is_array($_SESSION['module_'.$id_module])) {
} }
} }
if (sizeof($search_filters) > 0) { if (!empty($search_filters)) {
$module_query = str_replace('1=1', '1=1 AND ('.implode(' AND ', $search_filters).') ', $module_query); $module_query = str_replace('2=2', '2=2 AND ('.implode(' AND ', $search_filters).') ', $module_query);
} }
// Aggiungo eventuali filtri dei permessi // Filtri derivanti dai permessi (eventuali)
if ($additional_where[$rs[0]['name']] != '') { $module_query = Modules::replaceAdditionals($id_module, $module_query);
$module_query = str_replace('1=1', '1=1 '.$additional_where[$rs[0]['name']], $module_query);
}
$rsi = $dbo->fetchArray($module_query); $rsi = $dbo->fetchArray($module_query);