hasPermission("MACHINEMANAGER_EDIT")) { http_response_code(403); sendJsonResp("You don't have permission to edit.", "ERROR"); } if (!empty($VARS["model"])) { $machine->setModel($VARS['model']); } if (!empty($VARS["client"])) { $machine->setClientID($VARS['client']); } if (!empty($VARS["os"])) { $machine->setOS($VARS['os']); } if (!empty($VARS["serial"])) { $machine->setSerial($VARS['serial']); } if (!empty($VARS["manufacturer"])) { $machine->setManufacturer($VARS['manufacturer']); } if (!empty($VARS["condition"])) { $machine->setCondition($VARS['condition']); } if (!empty($VARS["price"])) { $machine->setPrice($VARS['price']); } if (!empty($VARS["privatenotes"])) { $machine->setPrivateNotes($VARS['privatenotes']); } if (!empty($VARS["publicnotes"])) { $machine->setPublicNotes($VARS['publicnotes']); } $machine->save(); } header("Content-Type: application/json"); $output = $machine->toArray(); $output["editable"] = $user->hasPermission("MACHINEMANAGER_EDIT"); exit(json_encode($output));