summaryrefslogtreecommitdiffstats
path: root/src
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 /src
parent4dcf459bfb1f71adf246e74aba242f633331448c (diff)
parent8d857037028ecc7380c3b43ac87f069b1c15c68e (diff)
downloadserial-barcode-scanner-9a21b5c0d0f84bd6c0c626173d19441738fefb13.tar.bz2
Merge pull request #52 from smilix/master
some fixes for the details view
Diffstat (limited to 'src')
-rw-r--r--src/web/web.vala41
1 files changed, 18 insertions, 23 deletions
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;
}