From 3c03180a434a1b028d5352a97ac42c9f78a6d491 Mon Sep 17 00:00:00 2001 From: Guillaume28 <gbaldo@centreon.com> Date: Mon, 5 Mar 2018 15:06:07 +0100 Subject: [PATCH] fix(instance): Export with filter --- .../centreon-clapi/centreonInstance.class.php | 20 ++++++++++++++++++- .../centreon-clapi/centreonObject.class.php | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/www/class/centreon-clapi/centreonInstance.class.php b/www/class/centreon-clapi/centreonInstance.class.php index a8e783ab3b..518eea4aca 100644 --- a/www/class/centreon-clapi/centreonInstance.class.php +++ b/www/class/centreon-clapi/centreonInstance.class.php @@ -165,7 +165,7 @@ class CentreonInstance extends CentreonObject $elements = $this->object->getList($params, -1, 0, null, null, $filters); foreach ($elements as $tab) { if (isset($pollerState[$tab["id"]])) { - $tab["ns_status"] = $poller[$tab["id"]]; + $tab["ns_status"] = $pollerState[$tab["id"]]; } else { $tab["ns_status"] = '-'; } @@ -232,4 +232,22 @@ class CentreonInstance extends CentreonObject } } } + + /** + * Export data + * + * @param null $filter_id + * @param null $filter_name + */ + public function export($filter_id = null, $filter_name = null) + { + $filters = null; + if (!is_null($filter_id)) { + $filters = array( + $this->object->getPrimaryKey() => $filter_id + ); + } + + parent::export($filters); + } } diff --git a/www/class/centreon-clapi/centreonObject.class.php b/www/class/centreon-clapi/centreonObject.class.php index 366e68ac65..47ccfad329 100644 --- a/www/class/centreon-clapi/centreonObject.class.php +++ b/www/class/centreon-clapi/centreonObject.class.php @@ -407,7 +407,7 @@ abstract class CentreonObject /** * Export data * - * @param string $parameters + * @param string $filters * @return void */ public function export($filters = null) -- GitLab