summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--provisioning-model.lua21
-rwxr-xr-xprovisioning-scripts.lua2
2 files changed, 13 insertions, 10 deletions
diff --git a/provisioning-model.lua b/provisioning-model.lua
index 20b70e4..2c3ccb7 100644
--- a/provisioning-model.lua
+++ b/provisioning-model.lua
@@ -204,13 +204,15 @@ logevent(err)
end
local validateparam
-validateparam = function(p)
+validateparam = function(p, allowdefault)
if p.type == "group" then
local success = true
for n,p2 in pairs(p.value) do
- success = validateparam(p2) and success
+ success = validateparam(p2, allowdefault) and success
end
return success
+ elseif allowdefault and p.value == p.default then
+ return true
elseif p.type == "select" then
return modelfunctions.validateselect(p)
elseif p.type == "text" and p.regexp and p.regexp ~= "" then
@@ -851,6 +853,7 @@ get_group = function(group_id)
sql = "SELECT * FROM provisioning_options WHERE param_id='"..escape(p.param_id).."' ORDER BY seq ASC"
p.option = getselectresponse(sql) or {}
end
+ p.default = p.value
if p.type == "boolean" then
p.value = (p.value == "true")
end
@@ -876,11 +879,11 @@ get_group = function(group_id)
end
if p.value then
retval.default.value[#retval.default.value + 1] = p.param_id
- end
- if retval.defaults.value[p.param_id].type == "boolean" then
- retval.defaults.value[p.param_id].value = (p.value == "true")
- else
- retval.defaults.value[p.param_id].value = p.value
+ if retval.defaults.value[p.param_id].type == "boolean" then
+ retval.defaults.value[p.param_id].value = (p.value == "true")
+ else
+ retval.defaults.value[p.param_id].value = p.value
+ end
end
end
end
@@ -924,8 +927,8 @@ update_group = function(group, create)
group.value.seq.errtxt = "Must be an integer"
end
-- Validate the param defaults
- for i,p in ipairs(group.value.default.value) do
- success = validateparam(group.value.defaults.value[p]) and success
+ for i,p in pairs(group.value.defaults.value) do
+ success = validateparam(p, true) and success
end
if success then
local res, err = pcall(function()
diff --git a/provisioning-scripts.lua b/provisioning-scripts.lua
index e487551..ed4ce01 100755
--- a/provisioning-scripts.lua
+++ b/provisioning-scripts.lua
@@ -706,7 +706,7 @@ provisioning_params = {
"INSERT INTO provisioning_params VALUES(default, 'forwardallenable', 'boolean', 'Forward All Calls Enable', '', 'false', '107', '', null)",
"INSERT INTO provisioning_params VALUES(default, 'forwardall', 'text', 'Forward All Calls Destination', 'All calls will be transferred to this extension', '', '108', '', null)",
"INSERT INTO provisioning_params VALUES(default, 'callerid', 'text', 'Caller ID String', '', '', '109', '', null)",
- "INSERT INTO provisioning_params VALUES(default, 'polycomringtone', 'select', 'Ring Tone', '', '2', '110', '', null)",
+ "INSERT INTO provisioning_params VALUES(default, 'polycomringtone', 'select', 'Ring Tone (Polycom)', '', '2', '110', '', null)",
"INSERT INTO provisioning_params VALUES(default, 'forwarding', 'boolean', 'Forwarding Enable', '', 'true', '201', '', null)",
"INSERT INTO provisioning_params VALUES(default, 'hotlineenable', 'boolean', 'Hotline Enable', '', 'false', '202', '', null)",
"INSERT INTO provisioning_params VALUES(default, 'hotlinedestination', 'text', 'Hotline Destination', '', '', '203', '', null)",