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

pull/5198/head
iglocska 2019-09-18 14:37:42 +02:00
parent d9d03f7c75
commit 71d8436cbc
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
2 changed files with 11 additions and 1 deletions

View File

@ -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;
}
}
}

View File

@ -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;">