Merge branch '1826_Sentencia_UNION_restringida_en_informes_SQL' into 'develop'

Fixed error sql

See merge request artica/pandorafms!1262
This commit is contained in:
vgilc 2018-01-25 10:12:58 +01:00
commit 23baecc67a

View File

@ -362,7 +362,7 @@ switch ($action) {
break; break;
case 'sql': case 'sql':
$description = $item['description']; $description = $item['description'];
$sql = $item['external_source']; $sql_query_report = $item['external_source'];
$idCustom = $item['treport_custom_sql_id']; $idCustom = $item['treport_custom_sql_id'];
$header = $item['header_definition']; $header = $item['header_definition'];
$historical_db = $item['historical_db']; $historical_db = $item['historical_db'];
@ -940,7 +940,7 @@ You can of course remove the warnings, that's why we include the source and do n
$agents = agents_get_group_agents($group); $agents = agents_get_group_agents($group);
if ((empty($agents)) || $agents == -1) $agents = array(); if ((empty($agents)) || $agents == -1) $agents = array();
$sql = 'SELECT source $sql_log = 'SELECT source
FROM tagente,tagent_module_log FROM tagente,tagent_module_log
WHERE tagente.id_agente = tagent_module_log.id_agent '; WHERE tagente.id_agente = tagent_module_log.id_agent ';
@ -948,16 +948,16 @@ You can of course remove the warnings, that's why we include the source and do n
$index = 0; $index = 0;
foreach ($agents as $key => $a) { foreach ($agents as $key => $a) {
if ($index == 0) { if ($index == 0) {
$sql .= ' AND (id_agente = ' . $key; $sql_log .= ' AND (id_agente = ' . $key;
} }
else { else {
$sql .= ' OR id_agente = ' . $key; $sql_log .= ' OR id_agente = ' . $key;
} }
$index++; $index++;
} }
$sql .= ")"; $sql_log .= ")";
} }
html_print_select_from_sql ($sql, 'source', $source, '', __('All'), '', false, false, false); html_print_select_from_sql ($sql_log, 'source', $source, '', __('All'), '', false, false, false);
?> ?>
</td> </td>
</tr> </tr>
@ -1076,10 +1076,10 @@ You can of course remove the warnings, that's why we include the source and do n
<td style="font-weight:bold;"><?php echo __('Agents'); ?></td> <td style="font-weight:bold;"><?php echo __('Agents'); ?></td>
<td> <td>
<?php <?php
$sql = 'SELECT id_agente, alias $sql_log_report = 'SELECT id_agente, alias
FROM tagente, tagent_module_log FROM tagente, tagent_module_log
WHERE tagente.id_agente = tagent_module_log.id_agent'; WHERE tagente.id_agente = tagent_module_log.id_agent';
$all_agent_log = db_get_all_rows_sql($sql); $all_agent_log = db_get_all_rows_sql($sql_log_report);
foreach ($all_agent_log as $key => $value) { foreach ($all_agent_log as $key => $value) {
$agents2[$value['id_agente']] = $value['alias']; $agents2[$value['id_agente']] = $value['alias'];
@ -1278,7 +1278,7 @@ You can of course remove the warnings, that's why we include the source and do n
<td style="font-weight:bold;"><?php echo __('SQL query'); ?></td> <td style="font-weight:bold;"><?php echo __('SQL query'); ?></td>
<td style="" id="sql_entry"> <td style="" id="sql_entry">
<?php <?php
html_print_textarea('sql', 5, 25, $sql); html_print_textarea('sql', 5, 25, $sql_query_report);
?> ?>
</td> </td>
<td style="" id="sql_example"></td> <td style="" id="sql_example"></td>