summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorholger <holgercremer@gmail.com>2020-01-04 22:06:17 +0100
committerGitHub <noreply@github.com>2020-01-04 22:06:17 +0100
commit9a21b5c0d0f84bd6c0c626173d19441738fefb13 (patch)
treea4c7dc3565470b482bcb17b104a33d5a3da4af10
parent4dcf459bfb1f71adf246e74aba242f633331448c (diff)
parent8d857037028ecc7380c3b43ac87f069b1c15c68e (diff)
downloadserial-barcode-scanner-9a21b5c0d0f84bd6c0c626173d19441738fefb13.tar.bz2
Merge pull request #52 from smilix/masterHEADmaster
some fixes for the details view
-rw-r--r--data/po/de.po72
-rw-r--r--data/po/shopsystem.pot72
-rw-r--r--data/templates/cashbox/index.html18
-rw-r--r--data/templates/cashbox/selection.html17
-rw-r--r--src/web/web.vala41
5 files changed, 107 insertions, 113 deletions
diff --git a/data/po/de.po b/data/po/de.po
index d875470..7c906ef 100644
--- a/data/po/de.po
+++ b/data/po/de.po
@@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: shopsystem 0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2018-07-24 20:00+0200\n"
+"POT-Creation-Date: 2020-01-04 20:55+0000\n"
"PO-Revision-Date: 2018-06-28 21:14+0200\n"
"Last-Translator: Sebastian Reichel <sre@ring0.de>\n"
"Language-Team: German\n"
@@ -129,11 +129,11 @@ msgstr "Konnte DBus-Service nicht registrieren\n"
msgid "Could not register service: %s\n"
msgstr "Konnte DBus-Servicenicht registieren: %s\n"
-#: web/web.vala:1465
+#: web/web.vala:1660
msgid "Could not setup webserver!"
msgstr "Konnte Webserver nicht konfigurieren!"
-#: web/main.vala:81
+#: web/main.vala:83
#, c-format
msgid "Could not start Webserver: %s\n"
msgstr "Konnte Webserver nicht starten: %s\n"
@@ -145,8 +145,8 @@ msgstr "DBus Fehler: %s"
#: audio/main.vala:42 curses-ui/main.vala:65 database/main.vala:31
#: input-device/main.vala:33 pdf-invoice/main.vala:27 pdf-invoice/test.vala:58
-#: pgp/main.vala:31 serial-device/main.vala:31 web/main.vala:46
-#: web/main.vala:57 web/main.vala:68
+#: pgp/main.vala:31 serial-device/main.vala:31 web/main.vala:48
+#: web/main.vala:59 web/main.vala:70
#, c-format
msgid "DBus Error: %s\n"
msgstr "DBus Fehler: %s\n"
@@ -178,7 +178,7 @@ msgstr "Fehler: %s"
#: backup/main.vala:41 invoice/main.vala:51 invoice/main.vala:58
#: invoice/single.vala:51 invoice/single.vala:58 mail/main.vala:26
-#: web/web.vala:1123 web/web.vala:1141
+#: web/web.vala:1318 web/web.vala:1336
#, c-format
msgid "Error: %s\n"
msgstr "Fehler: %s\n"
@@ -239,7 +239,7 @@ msgstr "EA Fehler: %s"
#: input-device/main.vala:29 pdf-invoice/main.vala:29 pdf-invoice/test.vala:22
#: pdf-invoice/test.vala:60 pgp/main.vala:33
#: scanner-session/scannersession.vala:49 serial-device/main.vala:27
-#: web/main.vala:42 web/main.vala:55 web/main.vala:66
+#: web/main.vala:44 web/main.vala:57 web/main.vala:68
#, c-format
msgid "IO Error: %s\n"
msgstr "EA Fehler: %s\n"
@@ -268,7 +268,7 @@ msgstr "Interner Fehler!"
msgid "Invoice PDF Error: %s\n"
msgstr "Datei Fehler: %s\n"
-#: curses-ui/main.vala:67 web/main.vala:44 web/main.vala:53 web/main.vala:64
+#: curses-ui/main.vala:67 web/main.vala:46 web/main.vala:55 web/main.vala:66
#, c-format
msgid "KeyFile Error: %s\n"
msgstr "Schlüsseldatei Fehler: %s\n"
@@ -322,11 +322,11 @@ msgstr "Kein Rechnungsempfänger übergeben!"
msgid "No such mail"
msgstr "Mail wurde nicht gefunden"
-#: database/database.vala:612
+#: database/database.vala:613
msgid "No such session available in database!"
msgstr "Keine solche Session in der Datenbank verfügbar!"
-#: database/database.vala:711 database/database.vala:723
+#: database/database.vala:712 database/database.vala:724
msgid "No such user available in database!"
msgstr "Kein solcher Nutzer in der Datenbank verfügbar!"
@@ -349,7 +349,7 @@ msgstr "Mögliche Werte für <temporary>: temporary, final\n"
msgid "Prices > 9999.99€ are not supported!"
msgstr "Preise > 9999,99€ werden nicht unterstützt!"
-#: database/database.vala:488
+#: database/database.vala:489
#, c-format
msgid "Remove purchase of %s"
msgstr "Einkaufsposten %s wurde entfernt"
@@ -377,12 +377,12 @@ msgstr "Shop System wurde gestartet"
msgid "Stopping Shop System"
msgstr "Shop System wird gestoppt"
-#: web/main.vala:72
+#: web/main.vala:74
#, c-format
msgid "TLS certificate: %s\n"
msgstr "TLS Zertifikat: %s\n"
-#: web/main.vala:73
+#: web/main.vala:75
#, c-format
msgid "TLS private key: %s\n"
msgstr "TLS Privater Schlüssel: %s\n"
@@ -396,7 +396,7 @@ msgstr "Unbekannter Nachrichten Typ"
msgid "Usage: %s <temporary> [timestamp]\n"
msgstr "Benutzung: %s <temporary> [timestamp]\n"
-#: web/main.vala:71
+#: web/main.vala:73
#, c-format
msgid "Web Server Port: %u\n"
msgstr "Webserver Port: %u\n"
@@ -431,22 +431,22 @@ msgstr "Konnte Server nicht konfigurieren"
msgid "eSMTP: Start Session failed!"
msgstr "eSMTP: Session Start fehlgeschlagen!"
-#: database/database.vala:371 database/database.vala:388
-#: database/database.vala:404 database/database.vala:420
-#: database/database.vala:436 database/database.vala:449
-#: database/database.vala:471 database/database.vala:493
-#: database/database.vala:501 database/database.vala:528
-#: database/database.vala:542 database/database.vala:557
-#: database/database.vala:584 database/database.vala:592
-#: database/database.vala:602 database/database.vala:639
-#: database/database.vala:676 database/database.vala:690
-#: database/database.vala:701 database/database.vala:738
-#: database/database.vala:766 database/database.vala:885
-#: database/database.vala:893 database/database.vala:914
-#: database/database.vala:920 database/database.vala:928
-#: database/database.vala:983 database/database.vala:1046
-#: database/database.vala:1097 database/database.vala:1147
-#: database/database.vala:1230
+#: database/database.vala:372 database/database.vala:389
+#: database/database.vala:405 database/database.vala:421
+#: database/database.vala:437 database/database.vala:450
+#: database/database.vala:472 database/database.vala:494
+#: database/database.vala:502 database/database.vala:529
+#: database/database.vala:543 database/database.vala:558
+#: database/database.vala:585 database/database.vala:593
+#: database/database.vala:603 database/database.vala:640
+#: database/database.vala:677 database/database.vala:691
+#: database/database.vala:702 database/database.vala:739
+#: database/database.vala:767 database/database.vala:896
+#: database/database.vala:904 database/database.vala:925
+#: database/database.vala:931 database/database.vala:939
+#: database/database.vala:994 database/database.vala:1057
+#: database/database.vala:1108 database/database.vala:1158
+#: database/database.vala:1241
#, c-format
msgid "internal error: %d"
msgstr "Interner Fehler: %d"
@@ -463,23 +463,23 @@ msgstr "Server oder Port Konfiguration fehlt"
msgid "short read!\n"
msgstr "Unvollständige Daten aus Gerätedatei gelesen\n"
-#: database/database.vala:491
+#: database/database.vala:492
msgid "undo not possible without purchases"
msgstr "Rückgängig nicht möglich ohne Einkäufe"
-#: database/database.vala:386 database/database.vala:402
-#: database/database.vala:418 database/database.vala:434
-#: database/database.vala:469
+#: database/database.vala:387 database/database.vala:403
+#: database/database.vala:419 database/database.vala:435
+#: database/database.vala:470
#, c-format
msgid "unknown product: %llu"
msgstr "Unbekanntes Produkt: %llu"
-#: database/database.vala:1228
+#: database/database.vala:1239
#, c-format
msgid "unknown rfid: %s"
msgstr "Unbekannter RFID: %s"
-#: database/database.vala:637
+#: database/database.vala:638
msgid "user not found"
msgstr "User nicht gefunden"
diff --git a/data/po/shopsystem.pot b/data/po/shopsystem.pot
index cd8e21d..43e1df4 100644
--- a/data/po/shopsystem.pot
+++ b/data/po/shopsystem.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: shopsystem\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2018-07-24 20:00+0200\n"
+"POT-Creation-Date: 2020-01-04 20:55+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -130,11 +130,11 @@ msgstr ""
msgid "Could not register service: %s\n"
msgstr ""
-#: web/web.vala:1465
+#: web/web.vala:1660
msgid "Could not setup webserver!"
msgstr ""
-#: web/main.vala:81
+#: web/main.vala:83
#, c-format
msgid "Could not start Webserver: %s\n"
msgstr ""
@@ -146,8 +146,8 @@ msgstr ""
#: audio/main.vala:42 curses-ui/main.vala:65 database/main.vala:31
#: input-device/main.vala:33 pdf-invoice/main.vala:27 pdf-invoice/test.vala:58
-#: pgp/main.vala:31 serial-device/main.vala:31 web/main.vala:46
-#: web/main.vala:57 web/main.vala:68
+#: pgp/main.vala:31 serial-device/main.vala:31 web/main.vala:48
+#: web/main.vala:59 web/main.vala:70
#, c-format
msgid "DBus Error: %s\n"
msgstr ""
@@ -179,7 +179,7 @@ msgstr ""
#: backup/main.vala:41 invoice/main.vala:51 invoice/main.vala:58
#: invoice/single.vala:51 invoice/single.vala:58 mail/main.vala:26
-#: web/web.vala:1123 web/web.vala:1141
+#: web/web.vala:1318 web/web.vala:1336
#, c-format
msgid "Error: %s\n"
msgstr ""
@@ -240,7 +240,7 @@ msgstr ""
#: input-device/main.vala:29 pdf-invoice/main.vala:29 pdf-invoice/test.vala:22
#: pdf-invoice/test.vala:60 pgp/main.vala:33
#: scanner-session/scannersession.vala:49 serial-device/main.vala:27
-#: web/main.vala:42 web/main.vala:55 web/main.vala:66
+#: web/main.vala:44 web/main.vala:57 web/main.vala:68
#, c-format
msgid "IO Error: %s\n"
msgstr ""
@@ -269,7 +269,7 @@ msgstr ""
msgid "Invoice PDF Error: %s\n"
msgstr ""
-#: curses-ui/main.vala:67 web/main.vala:44 web/main.vala:53 web/main.vala:64
+#: curses-ui/main.vala:67 web/main.vala:46 web/main.vala:55 web/main.vala:66
#, c-format
msgid "KeyFile Error: %s\n"
msgstr ""
@@ -321,11 +321,11 @@ msgstr ""
msgid "No such mail"
msgstr ""
-#: database/database.vala:612
+#: database/database.vala:613
msgid "No such session available in database!"
msgstr ""
-#: database/database.vala:711 database/database.vala:723
+#: database/database.vala:712 database/database.vala:724
msgid "No such user available in database!"
msgstr ""
@@ -345,7 +345,7 @@ msgstr ""
msgid "Prices > 9999.99\342\202\254 are not supported!"
msgstr ""
-#: database/database.vala:488
+#: database/database.vala:489
#, c-format
msgid "Remove purchase of %s"
msgstr ""
@@ -373,12 +373,12 @@ msgstr ""
msgid "Stopping Shop System"
msgstr ""
-#: web/main.vala:72
+#: web/main.vala:74
#, c-format
msgid "TLS certificate: %s\n"
msgstr ""
-#: web/main.vala:73
+#: web/main.vala:75
#, c-format
msgid "TLS private key: %s\n"
msgstr ""
@@ -392,7 +392,7 @@ msgstr ""
msgid "Usage: %s <temporary> [timestamp]\n"
msgstr ""
-#: web/main.vala:71
+#: web/main.vala:73
#, c-format
msgid "Web Server Port: %u\n"
msgstr ""
@@ -427,22 +427,22 @@ msgstr ""
msgid "eSMTP: Start Session failed!"
msgstr ""
-#: database/database.vala:371 database/database.vala:388
-#: database/database.vala:404 database/database.vala:420
-#: database/database.vala:436 database/database.vala:449
-#: database/database.vala:471 database/database.vala:493
-#: database/database.vala:501 database/database.vala:528
-#: database/database.vala:542 database/database.vala:557
-#: database/database.vala:584 database/database.vala:592
-#: database/database.vala:602 database/database.vala:639
-#: database/database.vala:676 database/database.vala:690
-#: database/database.vala:701 database/database.vala:738
-#: database/database.vala:766 database/database.vala:885
-#: database/database.vala:893 database/database.vala:914
-#: database/database.vala:920 database/database.vala:928
-#: database/database.vala:983 database/database.vala:1046
-#: database/database.vala:1097 database/database.vala:1147
-#: database/database.vala:1230
+#: database/database.vala:372 database/database.vala:389
+#: database/database.vala:405 database/database.vala:421
+#: database/database.vala:437 database/database.vala:450
+#: database/database.vala:472 database/database.vala:494
+#: database/database.vala:502 database/database.vala:529
+#: database/database.vala:543 database/database.vala:558
+#: database/database.vala:585 database/database.vala:593
+#: database/database.vala:603 database/database.vala:640
+#: database/database.vala:677 database/database.vala:691
+#: database/database.vala:702 database/database.vala:739
+#: database/database.vala:767 database/database.vala:896
+#: database/database.vala:904 database/database.vala:925
+#: database/database.vala:931 database/database.vala:939
+#: database/database.vala:994 database/database.vala:1057
+#: database/database.vala:1108 database/database.vala:1158
+#: database/database.vala:1241
#, c-format
msgid "internal error: %d"
msgstr ""
@@ -459,23 +459,23 @@ msgstr ""
msgid "short read!\n"
msgstr ""
-#: database/database.vala:491
+#: database/database.vala:492
msgid "undo not possible without purchases"
msgstr ""
-#: database/database.vala:386 database/database.vala:402
-#: database/database.vala:418 database/database.vala:434
-#: database/database.vala:469
+#: database/database.vala:387 database/database.vala:403
+#: database/database.vala:419 database/database.vala:435
+#: database/database.vala:470
#, c-format
msgid "unknown product: %llu"
msgstr ""
-#: database/database.vala:1228
+#: database/database.vala:1239
#, c-format
msgid "unknown rfid: %s"
msgstr ""
-#: database/database.vala:637
+#: database/database.vala:638
msgid "user not found"
msgstr ""
diff --git a/data/templates/cashbox/index.html b/data/templates/cashbox/index.html
index 4a088b6..9f5c81b 100644
--- a/data/templates/cashbox/index.html
+++ b/data/templates/cashbox/index.html
@@ -27,4 +27,20 @@
<tr><td>Date &amp; Time</td><td>Name</td><td>Amount</td></tr>
{{{CASHBOX_HISTORY}}}
</table>
-<a href="/cashbox/details">Details for a specific month</a>
+
+<legend>Details</legend>
+<div class="form-inline">
+ <div class="form-group">
+ <input id="yearDetail" class="form-control" type="number" placeholder="Year"/>
+ <input id="monthDetail" class="form-control" type="number" placeholder="Month"/>
+ <button class="form-control btn btn-default" onclick="showDetails()"></span>Show Details</button>
+ </div>
+</div>
+
+<script>
+function showDetails() {
+ var year = document.getElementById("yearDetail").value;
+ var month = document.getElementById("monthDetail").value;
+ location.href = location.pathname + "/details/" + year + "/" + month;
+}
+</script>
diff --git a/data/templates/cashbox/selection.html b/data/templates/cashbox/selection.html
deleted file mode 100644
index e15ee75..0000000
--- a/data/templates/cashbox/selection.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<h1>Cashbox Account</h1>
-
-<script>
-function onSubmit() {
- d = document.getElementsByName("date")[0].value
- if (d.indexOf("-") > 0) {
- var split = d.split("-")
- var uri = location.protocol + '//' + location.host + location.pathname + "/" + split[0] + "/" + split[1]
- self.location = uri;
- }
-}
-</script>
-
-<form>
- <input type="month" name="date" />
- <input type="button" value="Go" onclick="onSubmit()" />
-</form>
diff --git a/src/web/web.vala b/src/web/web.vala
index 5dcceef..0ed852d 100644
--- a/src/web/web.vala
+++ b/src/web/web.vala
@@ -1541,30 +1541,25 @@ public class WebServer {
}
void handler_cashbox_detail_selection(Soup.Server server, Soup.Message msg, string path, GLib.HashTable? query, Soup.ClientContext client) {
- string[] pathparts = path.split("/");
+ try {
+ string[] pathparts = path.split("/");
- if(pathparts.length > 4) {
- DateYear year = (DateYear) int.parse(pathparts[3]);
- DateMonth month = (DateMonth) int.parse(pathparts[4]);
- handler_cashbox_detail(server, msg, path, query, client, year, month);
- } else {
- try {
- var session = new WebSession(server, msg, path, query, client);
- var template = new WebTemplate("cashbox/selection.html", session);
- template.replace("TITLE", shortname + " Shop System: Cashbox Detail");
- template.menu_set_active("cashbox");
- msg.set_response("text/html", Soup.MemoryUse.COPY, template.data);
- msg.set_status(200);
- } catch(TemplateError e) {
- stderr.printf(e.message+"\n");
- handler_404(server, msg, path, query, client);
- } catch(DatabaseError e) {
- handler_400(server, msg, path, query, client, e.message);
- } catch(IOError e) {
- handler_400(server, msg, path, query, client, e.message);
- } catch(DBusError e) {
- handler_400(server, msg, path, query, client, e.message);
+ if(pathparts.length > 4) {
+ DateYear year = (DateYear) int.parse(pathparts[3]);
+ DateMonth month = (DateMonth) int.parse(pathparts[4]);
+ handler_cashbox_detail(server, msg, path, query, client, year, month);
+ } else {
+ msg.set_redirect(302, "/cashbox");
}
+ } catch(TemplateError e) {
+ stderr.printf(e.message+"\n");
+ handler_404(server, msg, path, query, client);
+ } catch(DatabaseError e) {
+ handler_400(server, msg, path, query, client, e.message);
+ } catch(IOError e) {
+ handler_400(server, msg, path, query, client, e.message);
+ } catch(DBusError e) {
+ handler_400(server, msg, path, query, client, e.message);
}
}
@@ -1572,7 +1567,7 @@ public class WebServer {
try {
var session = new WebSession(server, msg, path, query, client);
- if(!session.superuser) {
+ if(!session.superuser && !session.auth_cashbox) {
handler_403(server, msg, path, query, client);
return;
}