From 9e36a9ee043d8c6c24adb2c23d04aed4b8355d7c Mon Sep 17 00:00:00 2001 From: Pranav Nachanekar Date: Fri, 4 Oct 2019 11:28:29 +0530 Subject: [PATCH] fix: move enable check to serverside --- erpnext/www/book-appointment/index.js | 10 ---------- erpnext/www/book-appointment/index.py | 6 ++++++ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/erpnext/www/book-appointment/index.js b/erpnext/www/book-appointment/index.js index 07355e16ff..cfacc79dc2 100644 --- a/erpnext/www/book-appointment/index.js +++ b/erpnext/www/book-appointment/index.js @@ -1,14 +1,4 @@ frappe.ready(async () => { - debugger - let isSchedulingEnabled = await frappe.call({ - method:'erpnext.www.book-appointment.index.is_enabled' - }) - isSchedulingEnabled = isSchedulingEnabled.message - if (!isSchedulingEnabled) { - frappe.show_alert("This feature is not enabled"); - window.location.replace('/'); - return; - } initialise_select_date(); }) diff --git a/erpnext/www/book-appointment/index.py b/erpnext/www/book-appointment/index.py index a810a2b323..1a9afa577e 100644 --- a/erpnext/www/book-appointment/index.py +++ b/erpnext/www/book-appointment/index.py @@ -9,6 +9,12 @@ WEEKDAYS = ["Monday", "Tuesday", "Wednesday", no_cache = 1 +def get_context(context): + is_enabled = frappe.db.get_single_value('Appointment Booking Settings','enable_scheduling') + if is_enabled: + return context + else: + raise frappe.DoesNotExistError @frappe.whitelist(allow_guest=True) def get_appointment_settings():