]> git.plutz.net Git - confetti/commitdiff
enable deletion of ledgers
authorPaul Hänsch <paul@plutz.net>
Sat, 11 May 2024 15:05:01 +0000 (17:05 +0200)
committerPaul Hänsch <paul@plutz.net>
Sat, 11 May 2024 15:05:01 +0000 (17:05 +0200)
ledgers/delete.sh [new file with mode: 0755]

diff --git a/ledgers/delete.sh b/ledgers/delete.sh
new file mode 100755 (executable)
index 0000000..7b41921
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+delete="$(POST delete |PATH)"
+dtable="${_DATA}/ledgers/${delete##*/}"
+
+if [ "$dtable" ]; then
+  rm -- "${dtable}" \
+  || SET_COOKIE 0 message="Unable to delete ledger: \"$(HTML "$delete")\""
+else
+  SET_COOKIE 0 message="No such ledger: \"$(HTML "$delete")\""
+fi
+
+REDIRECT "${_BASE}/ledgers/"