3 _EXEC="$(realpath "${0%/*}")"
4 . "$_EXEC/cgilite/cgilite.sh"
5 . "$_EXEC/cgilite/logging.sh"
6 . "$_EXEC/cgilite/storage.sh"
7 . "$_EXEC/cgilite/session.sh"
10 printf 'Content-Type: text/html; charset=utf-8\r\n\r\n'
11 "$_EXEC/cgilite/html-sh.sed" <<EOF
13 [meta name="viewport" content="width=device-width"]
14 [link rel="stylesheet" type="text/css" href="/invoices.css"]
18 [a "/invoices/" Invoices]
19 [a "/clients/" Clients]
20 [a "/senders/" Senders]
28 # transaction ID to modify a given file
30 { stat -c %F%i%n%N%s%Y "$file" 2>&-
31 printf %s "$SESSION_ID"
33 } | sha256sum | cut -d\ -f1
36 info="$(PATH "${PATH_INFO}")"
38 which git && [ ! -d .git ] && {
40 mkdir -p clients/ invoices/ senders/
42 serverkey' >.gitignore
43 git add clients/ invoices/ senders/ .gitignore
44 git commit -m 'initialisation of invoice repo'
49 . "$_EXEC/cgilite/file.sh"
50 FILE "$_EXEC/invoices.css"
55 printf '[a .new href="/clients/%s" New]' "$(timeid)"
56 } | yield_page clients
60 edit_client "${info#/clients/}" |yield_page client
69 printf '[a .new href="/senders/%s" New]' "$(timeid)"
70 } | yield_page senders
74 edit_sender "${info#/senders/}" |yield_page sender
81 . "$_EXEC/invoices.sh"
83 printf '[a .new href="/invoices/%s" New]' "$(timeid)"
84 } | yield_page invoices
87 . "$_EXEC/invoices.sh"
88 edit_invoice "${info#/invoices/}" |yield_page invoice
91 . "$_EXEC/invoices.sh"
95 . "$_EXEC/cgilite/file.sh"
97 FILE "${file#/}" application/pdf