fix module name finish % pandora_enterprise#8570

This commit is contained in:
Daniel Barbero Martin 2022-02-11 13:22:35 +01:00
parent cbee39189f
commit 362c1d2a51
3 changed files with 12 additions and 9 deletions

View File

@ -31,6 +31,7 @@
global $config;
global $statusProcessInDB;
use PandoraFMS\Agent;
use PandoraFMS\User;
check_login();
@ -705,15 +706,13 @@ switch ($activeTab) {
} else {
foreach ($name_modules as $mod) {
foreach ($id_agents as $ag) {
$id_module = agents_get_modules(
$ag,
['id_agente_modulo'],
['nombre' => $mod]
);
$agent = new Agent($ag);
$id_module = $agent->searchModules(
['nombre' => $mod],
1
)->id_agente_modulo();
if (empty($id_module)) {
if (empty($id_module) === true) {
continue;
} else {
$id_module = reset($id_module);

View File

@ -1430,6 +1430,9 @@ function agents_get_group_agents(
/**
* @deprecated use \PandoraFMS\Agent::searchModules
*
*
* Get all the modules in an agent. If an empty list is passed it will select all
*
* @param mixed Agent id to get modules. It can also be an array of agent id's, by default is null and this mean that use the ids of agents in user's groups.

View File

@ -549,7 +549,8 @@ class Agent extends Entity
* @param array $filter Filters.
* @param integer $limit Limit search results.
*
* @return array Of PandoraFMS\Module Modules found.
* @return array|Module Of PandoraFMS\Module Modules
* found or Module found is limit 1.
*/
public function searchModules(array $filter, int $limit=0)
{