summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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);
}
}