mirror of https://github.com/MISP/MISP
fix: [UI] If a server add with a newly created external organisation fails, set the external organisation as the currently selected option after the validation fail redirect, fixes #5182
parent
d9d03f7c75
commit
71d8436cbc
|
@ -310,6 +310,7 @@ class ServersController extends AppController
|
|||
$this->request->data['Server']['external_uuid'] = $json['uuid'];
|
||||
} else {
|
||||
$this->request->data['Server']['remote_org_id'] = $this->Server->Organisation->id;
|
||||
$this->request->data['Server']['organisation_type'] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,16 @@
|
|||
<div id="ServerExternalContainer" class="input select hiddenField" style="display:none;">
|
||||
<label for="ServerExternal"><?php echo __('External Organisation');?></label>
|
||||
<select id="ServerExternal">
|
||||
<?php foreach ($externalOrganisations as $k => $v) echo '<option value="' . $k . '">' . h($v) . '</option>'; ?>
|
||||
<?php
|
||||
foreach ($externalOrganisations as $k => $v) {
|
||||
echo sprintf(
|
||||
'<option value="%s" %s>%s</option>',
|
||||
h($k),
|
||||
(!empty($this->request->data['Server']['remote_org_id']) && $k == $this->request->data['Server']['remote_org_id']) ? 'selected' : '',
|
||||
h($v)
|
||||
);
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div id="ServerLocalContainer" class="input select hiddenField" style="display:none;">
|
||||
|
|
Loading…
Reference in New Issue