diff options
Diffstat (limited to 'vmail-model.lua')
-rw-r--r-- | vmail-model.lua | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/vmail-model.lua b/vmail-model.lua index 3ae8b6b..a9eeb59 100644 --- a/vmail-model.lua +++ b/vmail-model.lua @@ -32,7 +32,8 @@ local voicemail_values_creation_script = { local voicemail_params_creation_script = { "CREATE TABLE voicemail_params (name VARCHAR(255) primary key, type VARCHAR(255), label VARCHAR(255), descr VARCHAR(255), value VARCHAR(255))", "INSERT INTO voicemail_params VALUES('username', 'text', 'Extension', '', '')", - "INSERT INTO voicemail_params VALUES('fullname', 'text', 'Full User Name', '', '')", + "INSERT INTO voicemail_params VALUES('firstname', 'text', 'User First Name', '', '')", + "INSERT INTO voicemail_params VALUES('lastname', 'text', 'User Last Name', '', '')", "INSERT INTO voicemail_params VALUES('vm-password', 'text', 'Voicemail Password', '', '')", "INSERT INTO voicemail_params VALUES('vm-password-confirm', 'text', 'Enter again to confirm', '', '')", "INSERT INTO voicemail_params VALUES('vm-mailto', 'text', 'Email Address', 'Email a notification, including audio file if enabled', '')", @@ -546,15 +547,14 @@ list_users = function() if string.find(u.username, "^tempuser") then table.remove(users, i) else - local sql = "SELECT value FROM voicemail_values"..generatewhereclause(u.username).." and name='fullname'" + local sql = "SELECT * FROM voicemail_values"..generatewhereclause(u.username).." and (name='firstname' or name='lastname')" local cur = con:execute(sql) - if cur then - local row = cur:fetch ({}, "a") - if row and row.value then - u.fullname = row.value - end - cur:close() + local row = cur:fetch ({}, "a") + while row do + u[row.name] = row.value + row = cur:fetch (row, "a") end + cur:close() end end if connected then databasedisconnect() end |