From cb0e2a43db75096c672ce11bde227b9972973f1f Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Mon, 7 Dec 2015 17:19:27 +0000 Subject: Allow bulkcreatedevices to use exact match to label for select option --- provisioning-model.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/provisioning-model.lua b/provisioning-model.lua index 0a86e97..40603c6 100644 --- a/provisioning-model.lua +++ b/provisioning-model.lua @@ -2420,9 +2420,12 @@ mymodule.bulk_create_devices = function(self, devicelist) end end if not found then - -- Check for string match + -- Check for string match to label for k,c in ipairs(class.option) do - if string.find(c.label, format.escapemagiccharacters(value)) then + if c.label == value then + found = c.value + break + elseif string.find(c.label, format.escapemagiccharacters(value)) then if found then error("Ambiguous "..name.." class in line "..i) end @@ -2461,7 +2464,7 @@ mymodule.bulk_create_devices = function(self, devicelist) -- Allow the select value to be the value or a unique substring of the label local found = false for k,o in ipairs(params.value[class].value[param].option) do - if values[j] == o.value then + if values[j] == o.value or values[j] == o.label then found = o.value break elseif values[j] ~= "" and string.find(o.label, format.escapemagiccharacters(values[j])) then -- cgit v1.2.3