DirectorObjectForm: deal with "no template"...
...when fetching Choices fixes #2268
This commit is contained in:
parent
21a284abbc
commit
e2a8886148
|
@ -1184,11 +1184,15 @@ abstract class DirectorObjectForm extends DirectorForm
|
|||
$choices = IcingaObject::loadAllByType($choiceType, $connection);
|
||||
$chosenTemplates = $this->getSentOrObjectValue('imports');
|
||||
$db = $connection->getDbAdapter();
|
||||
$importedIds = $db->fetchCol(
|
||||
$db->select()->from($table, 'id')
|
||||
->where('object_name in (?)', (array)$chosenTemplates)
|
||||
->where('object_type = ?', 'template')
|
||||
);
|
||||
if (empty($chosenTemplates)) {
|
||||
$importedIds = [];
|
||||
} else {
|
||||
$importedIds = $db->fetchCol(
|
||||
$db->select()->from($table, 'id')
|
||||
->where('object_name in (?)', (array)$chosenTemplates)
|
||||
->where('object_type = ?', 'template')
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($choices as $choice) {
|
||||
$required = $choice->get('required_template_id');
|
||||
|
|
Loading…
Reference in New Issue