summaryrefslogtreecommitdiffstats
path: root/src/web/web.vala
diff options
context:
space:
mode:
authorHolger Cremer <HolgerCremer@gmail.com>2020-01-04 21:56:53 +0100
committerHolger Cremer <HolgerCremer@gmail.com>2020-01-04 21:56:53 +0100
commit5094fc329619895583227de6b9f8bb0242503d07 (patch)
treef6f3701892fcf6389482223e2e96ac8cafe64a02 /src/web/web.vala
parentd92aa9d79a3f80557119b660f7191e96b7d79878 (diff)
downloadserial-barcode-scanner-5094fc329619895583227de6b9f8bb0242503d07.tar.bz2
improves the cashbox detail view
Diffstat (limited to 'src/web/web.vala')
-rw-r--r--src/web/web.vala39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/web/web.vala b/src/web/web.vala
index 5dcceef..a4c24ca 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);
}
}