#13433 Fixed error 500 when filtering. The none option is left by default when loading report data

This commit is contained in:
Jorge Rincon 2024-04-19 10:25:59 +02:00
parent c52254ffea
commit cae5bcd164
3 changed files with 6 additions and 3 deletions

View File

@ -2343,7 +2343,7 @@ if (is_metaconsole() === true) {
if ($idAgent) {
$sql = 'SELECT id_agente_modulo, nombre
FROM tagente_modulo
WHERE id_agente = "'.$idAgent["id_agent"].'" AND delete_pending = 0';
WHERE id_agente = "'.$idAgent.'" AND delete_pending = 0';
if ($meta) {
$connection = metaconsole_get_connection($server_name);

View File

@ -1006,10 +1006,10 @@ function get_parameter($name, $default='')
function get_parameter_date($name, $default='', $date_format='Y/m/d')
{
// TODO: Configure default value.
$date_end = get_parameter('date_end', 0);
$time_end = get_parameter('time_end');
$datetime_end = strtotime($date_end.' '.$time_end);
$date_none = get_parameter($name, $default);
$custom_date = get_parameter('custom_date', 0);
$range = get_parameter($name, SECONDS_1DAY);
@ -1055,6 +1055,9 @@ function get_parameter_date($name, $default='', $date_format='Y/m/d')
$date_init = $first_of_week;
$period = (strtotime($date_end) - strtotime($first_of_week));
}
} else if ($date_none === 'none') {
// Prioritize the report item period based on the current local date/time.
$date_end = date('Y/m/d H:i:s');
} else {
$date_end = date('Y/m/d H:i:s');
$date_init = date('Y/m/d H:i:s', (strtotime($date_end) - $range));

View File

@ -43,7 +43,7 @@ if (!reporting_user_can_see_report($id_report)) {
exit;
}
$date_params = get_parameter_date('date', '', 'U');
$date_params = get_parameter_date('date', 'none', 'U');
$date_end = date('Y/m/d', $date_params['date_end']);
$time_end = date('H:i:s', $date_params['date_end']);