Merge pull request #25772 from deepeshgarg007/support_settings_query

fix: Check if user can read before querying Support Settings
This commit is contained in:
Deepesh Garg 2021-05-22 20:17:21 +05:30 committed by GitHub
commit 8a82b89308
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,15 +9,17 @@ frappe.ui.form.on("Issue", {
};
});
frappe.db.get_value("Support Settings", {name: "Support Settings"},
["allow_resetting_service_level_agreement", "track_service_level_agreement"], (r) => {
if (r && r.track_service_level_agreement == "0") {
frm.set_df_property("service_level_section", "hidden", 1);
}
if (r && r.allow_resetting_service_level_agreement == "0") {
frm.set_df_property("reset_service_level_agreement", "hidden", 1);
}
});
if (frappe.model.can_read("Support Settings")) {
frappe.db.get_value("Support Settings", {name: "Support Settings"},
["allow_resetting_service_level_agreement", "track_service_level_agreement"], (r) => {
if (r && r.track_service_level_agreement == "0") {
frm.set_df_property("service_level_section", "hidden", 1);
}
if (r && r.allow_resetting_service_level_agreement == "0") {
frm.set_df_property("reset_service_level_agreement", "hidden", 1);
}
});
}
if (frm.doc.service_level_agreement) {
frappe.call({