fix: move enable check to serverside

This commit is contained in:
Pranav Nachanekar 2019-10-04 11:28:29 +05:30
parent faf39ecef4
commit 9e36a9ee04
2 changed files with 6 additions and 10 deletions

View File

@ -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();
})

View File

@ -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():