summaryrefslogtreecommitdiffstats
path: root/db-viewtable-html.lsp
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-10-27 22:06:26 +0000
committerTed Trask <ttrask01@yahoo.com>2014-10-27 22:06:26 +0000
commitb9926ecbe8279f60d7dfe7648c7c0851cb0aaabc (patch)
treebbf79ef8a8c795b93551590bc4b78e3413a8a0ca /db-viewtable-html.lsp
parentb38802fae54ceef5e11a968b8ca0d74d4c1300b0 (diff)
downloadacf-db-b9926ecbe8279f60d7dfe7648c7c0851cb0aaabc.tar.bz2
acf-db-b9926ecbe8279f60d7dfe7648c7c0851cb0aaabc.tar.xz
Add code to determine the primary key fields and use them to uniquely identify rows
Previously, this assumed 'id' was the primary key column as inherited from the kamailio code
Diffstat (limited to 'db-viewtable-html.lsp')
-rw-r--r--db-viewtable-html.lsp12
1 files changed, 9 insertions, 3 deletions
diff --git a/db-viewtable-html.lsp b/db-viewtable-html.lsp
index 283d624..3bde35e 100644
--- a/db-viewtable-html.lsp
+++ b/db-viewtable-html.lsp
@@ -65,9 +65,9 @@ if form.value.connection then
formvalues.connection = form.value.connection
for n,v in pairs(form.value.connection.value) do v.type="hidden" end
end
-if form.value.fields then
+if form.value.keyfields then
formvalues.fields = cfe({ type="group", value={} })
- for i,f in ipairs(form.value.fields.value) do
+ for i,f in ipairs(form.value.keyfields.value) do
formvalues.fields.value[f] = cfe({ type="hidden" })
end
end
@@ -78,7 +78,13 @@ formvalues.redir = redir
<% for i,tableentry in ipairs(form.value.entries.value) do %>
<tr>
<% if viewlibrary.check_permission("deletetableentry") or viewlibrary.check_permission("updatetableentry") then %>
- <% formvalues.fields.value.id.value = tableentry.id %>
+ <%
+ if formvalues.fields then
+ for i,f in ipairs(form.value.keyfields.value) do
+ formvalues.fields.value[f].value = tableentry[f]
+ end
+ end
+ %>
<td>
<% if viewlibrary.check_permission("updatetableentry") then %>
<% htmlviewfunctions.displayitem(cfe({type="link", value=formvalues, label="", option="Update", action="updatetableentry"}), page_info, -1) %>