/** * * @cmdForm /centreon-bam/indicator/update optional * @cmdObject string ba the ba * @cmdObject string indicator-ba the indicator-ba kpi * @cmdObject string service the service kpi * @cmdObject string boolean the boolean kpi * @cmdParam none service-tags optional * @cmdParam boolean|false disable optional disable * @cmdParam boolean|true enable optional enable */ public function updateAction($object, $params = null) { IndicatorRepository::transco($params); IndicatorRepository::transco($object); $params['object'] = $this->objectName; IndicatorRepository::updateIndicator($this->parseObjectParams($params), 'api', '/centreon-bam/indicator/update', false, $this->parseObjectParams($object)); \Centreon\Internal\Utils\CommandLine\InputOutput::display("Object successfully updated", true, 'green'); }
/** * Generic update function * * @method post * @route /indicator/update */ public function updateAction() { $requestParam = $this->getParams(); $typeId = $requestParam['kpi_type']; $givenParameters = $this->getParams('post'); $updateSuccessful = true; $updateErrorMessage = ''; $aReturn = self::checkDatas($givenParameters); if (!$aReturn['success']) { $this->router->response()->json(array('success' => $aReturn['success'], 'error' => $aReturn['error'])); return; } try { IndicatorRepository::updateIndicator($givenParameters, 'form', $this->getUri()); unset($_SESSION['form_token']); unset($_SESSION['form_token_time']); $this->router->response()->json(array('success' => true)); } catch (\Centreon\Internal\Exception $e) { $updateSuccessful = false; $updateErrorMessage = $e->getMessage(); $this->router->response()->json(array('success' => false, 'error' => $updateErrorMessage)); } }