Merge branch 'ent-9939-Error-en-query-SQL-de-widget-Top-N-of-agent-module' into 'develop'

fixed query errors

See merge request artica/pandorafms!5306
This commit is contained in:
Daniel Rodriguez 2022-12-01 12:02:49 +00:00
commit 338e64c906
1 changed files with 8 additions and 0 deletions

View File

@ -375,11 +375,19 @@ class TopNWidget extends Widget
);
}
// Prevent double safe input in agents_get_group_agents function.
$agentRegex = io_safe_output($agentRegex);
// This function check ACL.
$agents = @agents_get_group_agents(0, ['aliasRegex' => $agentRegex]);
$agentsId = \array_keys($agents);
$agentsIdString = \implode(',', $agentsId);
// Prevent from error when performing IN clause with an empty string.
if ($agentsIdString === '') {
$agentsIdString = 'NULL';
}
// Initialize variables.
$date = \get_system_time();
$datelimit = ($date - $period);