fix: Error when posting server without server_state.

This commit is contained in:
2026-07-13 23:46:58 +02:00
parent f97bc6a7de
commit b94a3bdab7

View File

@@ -59,6 +59,7 @@ class API_servers extends API
{
# if the server_state that is posted is 'deleted' check if the current server state is 'new' if so, delete it perm.
if (isset($this->data['server_state'])) {
if ($this->data['server_state'] == 'deleted') {
$stmt = $GLOBALS['pdo']->prepare("SELECT server_state FROM servers WHERE server_vm_id = ? AND server_state = 'new'");
$stmt->execute([$this->data['server_vm_id']]);
@@ -69,12 +70,12 @@ class API_servers extends API
return;
}
}
if (isset($this->data['company_uuid'])) {
if (strlen($this->data['company_uuid']) == 0) {
$this->data['company_uuid'] = NULL;
}
}
}
$fields = [
'company_uuid',