Commit cbe10cfa authored by Ted Trask's avatar Ted Trask

Fix listusers when using sqlite

parent 729b70d5
......@@ -336,7 +336,7 @@ end
local delete_message = function(messages, username)
local retval = ""
local sql = "SELECT * FROM voicemail_msgs"
sql = sql .. generatewhereclause(username, messages)
local tmp = vmaildb.getselectresponse(sql)
......@@ -363,7 +363,7 @@ local delete_message = function(messages, username)
if not res and err then
return false, err
end
return retval
end
......@@ -512,7 +512,7 @@ mymodule.set_delete_message = function(self, deleterequest)
res, err = delete_message(messages, deleterequest.value.username.value)
if connected then databasedisconnect() end
end)
if res then
deleterequest.descr = res
end
......@@ -520,9 +520,9 @@ mymodule.set_delete_message = function(self, deleterequest)
if not res and err then
deleterequest.errtxt = err
end
return deleterequest
end
end
mymodule.get_forward_message = function(self, clientdata)
local result = {}
......@@ -781,7 +781,7 @@ mymodule.list_users = function(self, clientdata)
local res, err = pcall(function()
local connected = vmaildb.databaseconnect()
local filter = {}
for c,f in pairs(retval.value.filter.value) do
if columns[c] and f ~= "" then
......@@ -794,7 +794,7 @@ mymodule.list_users = function(self, clientdata)
sql = sql.." AND "..table.concat(filter, " AND ")
end
if page > 0 then
local count = vmaildb.getselectresponse("SELECT count(*)"..sql)
local count = vmaildb.getselectresponse("SELECT count(*) AS count"..sql)
retval.value.rowcount.value = count[1].count
end
sql = sql.." ORDER BY "..table.concat(orderby, ", ")
......@@ -852,7 +852,7 @@ end
mymodule.set_bunchsettings = function (self, bunchdata)
local res, err = pcall(function()
local connected = vmaildb.databaseconnect()
local entry = {}
entry.value = getuserparams()
if not entry.value or not entry.value.username or not entry.value.firstname or not entry.value.lastname or not entry.value["vm-password"] then
......@@ -894,7 +894,7 @@ mymodule.set_bunchsettings = function (self, bunchdata)
vmaildb.runsqlcommand(sql)
sql = "INSERT INTO voicemail_values VALUES('"..vmaildb.escape(uid[1].uid).."', '"..vmaildb.escape(entry.value.lastname.nid).."', '"..vmaildb.escape(tostring(lastname)).."')"
vmaildb.runsqlcommand(sql)
sql = "INSERT INTO voicemail_prefs (username, domain, password) VALUES ('"..vmaildb.escape(username).."', '"..config.domain.."', '"..vmaildb.escape(password).."')"
vmaildb.runsqlcommand(sql)
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment