Skip to main content

Hello,
I'm having a problem developing my widget. When I configure my configs.xml file, I add an input like this:

<preference label="List Host Name" name="list_host" defaultValue="" type="hostMulti" header="Test"/>

When i fill it in like this and click on apply, host id are sent. But when I go back to widget preferences,  hosts I entered have disappeared and I get this kind of error :

You should know that when I only put one host in the input, no error is displayed

 

the input of the hosts does not work, but the input of the hostgroups (bellow) works very well.

<preference label="List Hostgroup Name" name="list_hostgroup" defaultValue="" type="hostGroupMulti" header="Test"/>

Do you have any idea where the problem comes from?

Hi @Wisonic, I suppose their is a bug.

 

Can you create an issue on github ?

 

Can you try to change lines from 2484 to 2492 from /usr/share/centreon/www/class/centreonHost.class.php:

        if (!empty($values)) {
foreach ($values as $k => $v) {
$listValues .= ':host' . $v . ',';
$queryValuesu'host' . $v] = (int)$v;
}
$listValues = rtrim($listValues, ',');
} else {
$listValues .= "''";
}

To have:

        if (!empty($values)) {
foreach ($values as $k => $v) {
$multiValues = explode(',', $v);
foreach ($multiValues as $item) {
$listValues .= ':host' . $item . ',';
$queryValuesu'host' . $item] = (int)$item;
}
}
$listValues = rtrim($listValues, ',');
} else {
$listValues .= "''";
}

Regards


Github issue https://github.com/centreon/centreon/issues/10486


Reply