mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
Merge branch 'ent-8233-12588-Reports-Item-tipo-Increment-no-lee-datos-de-historico' into 'develop'
include historic db data in report See merge request artica/pandorafms!4623
This commit is contained in:
commit
c04ebf42e4
@ -874,10 +874,10 @@ function mysql_db_format_array_where_clause_sql($values, $join='AND', $prefix=fa
|
|||||||
*
|
*
|
||||||
* @return the first value of the first row of a table result from query.
|
* @return the first value of the first row of a table result from query.
|
||||||
*/
|
*/
|
||||||
function mysql_db_get_value_sql($sql, $dbconnection=false)
|
function mysql_db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
|
||||||
{
|
{
|
||||||
$sql .= ' LIMIT 1';
|
$sql .= ' LIMIT 1';
|
||||||
$result = mysql_db_get_all_rows_sql($sql, false, true, $dbconnection);
|
$result = mysql_db_get_all_rows_sql($sql, $search_history_db, true, $dbconnection);
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -977,10 +977,10 @@ function oracle_recode_query($sql, $values, $join='AND', $return=true)
|
|||||||
*
|
*
|
||||||
* @return the first value of the first row of a table result from query.
|
* @return the first value of the first row of a table result from query.
|
||||||
*/
|
*/
|
||||||
function oracle_db_get_value_sql($sql, $dbconnection=false)
|
function oracle_db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT * FROM ('.$sql.') WHERE rownum < 2';
|
$sql = 'SELECT * FROM ('.$sql.') WHERE rownum < 2';
|
||||||
$result = oracle_db_get_all_rows_sql($sql, false, true, $dbconnection);
|
$result = oracle_db_get_all_rows_sql($sql, $search_history_db, true, $dbconnection);
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -686,10 +686,10 @@ function postgresql_db_format_array_where_clause_sql($values, $join='AND', $pref
|
|||||||
*
|
*
|
||||||
* @return the first value of the first row of a table result from query.
|
* @return the first value of the first row of a table result from query.
|
||||||
*/
|
*/
|
||||||
function postgresql_db_get_value_sql($sql, $dbconnection=false)
|
function postgresql_db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
|
||||||
{
|
{
|
||||||
$sql .= ' LIMIT 1';
|
$sql .= ' LIMIT 1';
|
||||||
$result = postgresql_db_get_all_rows_sql($sql, false, true, $dbconnection);
|
$result = postgresql_db_get_all_rows_sql($sql, $search_history_db, true, $dbconnection);
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -414,21 +414,21 @@ function db_get_value_filter($field, $table, $filter, $where_join='AND', $search
|
|||||||
*
|
*
|
||||||
* @return mixed the first value of the first row of a table result from query.
|
* @return mixed the first value of the first row of a table result from query.
|
||||||
*/
|
*/
|
||||||
function db_get_value_sql($sql, $dbconnection=false)
|
function db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
switch ($config['dbtype']) {
|
switch ($config['dbtype']) {
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
return mysql_db_get_value_sql($sql, $dbconnection);
|
return mysql_db_get_value_sql($sql, $dbconnection, $search_history_db);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'postgresql':
|
case 'postgresql':
|
||||||
return postgresql_db_get_value_sql($sql, $dbconnection);
|
return postgresql_db_get_value_sql($sql, $dbconnection, $search_history_db);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
return oracle_db_get_value_sql($sql, $dbconnection);
|
return oracle_db_get_value_sql($sql, $dbconnection, $search_history_db);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -8775,6 +8775,8 @@ function reporting_increment($report, $content)
|
|||||||
|
|
||||||
$return['data'] = [];
|
$return['data'] = [];
|
||||||
|
|
||||||
|
$search_in_history_db = db_search_in_history_db($return['from']);
|
||||||
|
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole()) {
|
||||||
$sql1 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.'
|
$sql1 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.'
|
||||||
AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC';
|
AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC';
|
||||||
@ -8801,17 +8803,23 @@ function reporting_increment($report, $content)
|
|||||||
$connection = false;
|
$connection = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$old_data = db_get_value_sql($sql1);
|
$old_data = db_get_value_sql($sql1, false, $search_in_history_db);
|
||||||
|
|
||||||
$last_data = db_get_value_sql($sql2);
|
$last_data = db_get_value_sql($sql2, false, $search_in_history_db);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$old_data = db_get_value_sql(
|
$old_data = db_get_value_sql(
|
||||||
'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.'
|
'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.'
|
||||||
AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC'
|
AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC',
|
||||||
|
false,
|
||||||
|
$search_in_history_db
|
||||||
);
|
);
|
||||||
|
|
||||||
$last_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC');
|
$last_data = db_get_value_sql(
|
||||||
|
'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC',
|
||||||
|
false,
|
||||||
|
$search_in_history_db
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_metaconsole()) {
|
if (!is_metaconsole()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user