summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2011-03-04 14:15:45 +0000
committerTed Trask <ttrask01@yahoo.com>2011-03-04 14:15:45 +0000
commitf0ccd85ac609d63eedd0721dbcbc2257665aefc1 (patch)
treeac5e5613fd9f67372b2f7ed21aacf759cccd240c
parent4506e528fafecf02decc914684d23139ec414191 (diff)
downloadacf-provisioning-f0ccd85ac609d63eedd0721dbcbc2257665aefc1.tar.bz2
acf-provisioning-f0ccd85ac609d63eedd0721dbcbc2257665aefc1.tar.xz
Fail to create / update device if no classes selected
-rw-r--r--provisioning-listdevices-html.lsp4
-rw-r--r--provisioning-model.lua5
2 files changed, 7 insertions, 2 deletions
diff --git a/provisioning-listdevices-html.lsp b/provisioning-listdevices-html.lsp
index 17fee89..47c01cf 100644
--- a/provisioning-listdevices-html.lsp
+++ b/provisioning-listdevices-html.lsp
@@ -7,7 +7,7 @@ require("viewfunctions")
<script type="text/javascript">
<% -- Since we're including createdevice as a component, we break the automatic redirect
- if session.createdeviceresult then
+ if session.createdeviceresult and not session.createdeviceresult.errtxt then
local tmp = session.createdeviceresult
session.createdeviceresult = nil
-- Use JavaScript to redirect to the edit page
@@ -24,7 +24,7 @@ require("viewfunctions")
</script>
<% displaycommandresults({"deletedevice", "editdevice", "editdeviceparams", "overridedeviceparams"}, session) %>
-<% -- handled above displaycommandresults({"createdevice"}, session, true) %>
+<% displaycommandresults({"createdevice"}, session, true) %>
<h1>Devices</h1>
<DL>
diff --git a/provisioning-model.lua b/provisioning-model.lua
index 8f2470a..0c29426 100644
--- a/provisioning-model.lua
+++ b/provisioning-model.lua
@@ -1193,8 +1193,13 @@ update_device = function(device, create)
local success = true
local errtxt
-- Validate the settings
+ local something = false
for n,c in pairs(device.value.classes.value) do
success = modelfunctions.validateselect(c) and success
+ if c.value ~= "" then something = true end
+ end
+ if not something then
+ success = false
end
if success then
local res, err = pcall(function()