Merge branch 'ent-9181-problema-al-borrar-agentes-cuando-hay-modulos-delete-pending' into 'develop'

Ent 9181 problema al borrar agentes cuando hay modulos delete pending

See merge request artica/pandorafms!4973
This commit is contained in:
Daniel Rodriguez 2022-06-22 12:29:19 +00:00
commit 7e206716d7
2 changed files with 9 additions and 8 deletions

View File

@ -2598,10 +2598,9 @@ function agents_delete_agent($id_agents, $disableACL=false)
'tagente_modulo',
$filter
);
if (is_array($rows) === true) {
foreach ($rows as $row) {
$modules[] = PandoraFMS\Module::build($row);
$modules[] = PandoraFMS\Module::build($row, '\PandoraFMS\Module', true);
}
}

View File

@ -145,14 +145,15 @@ class Module extends Entity
/**
* Creates a module object from given data. Avoid query duplication.
*
* @param array $data Module information.
* @param string $class_str Class type.
*
* @param array $data Module information.
* @param string $class_str Class type.
* @param boolean $return_deleted_modules Check.
* @return PandoraFMS\Module Object.
*/
public static function build(
array $data=[],
string $class_str='\PandoraFMS\Module'
string $class_str='\PandoraFMS\Module',
bool $return_deleted_modules=false
) {
$obj = new $class_str();
@ -161,8 +162,9 @@ class Module extends Entity
$obj->{$k}($v);
}
if ($obj->nombre() === 'delete_pending'
|| $obj->nombre() === 'pendingdelete'
if (($obj->nombre() === 'delete_pending'
|| $obj->nombre() === 'pendingdelete')
&& $return_deleted_modules === false
) {
return null;
}