fix(HR Settings): Unable to save HR Settings (#17608)

This commit is contained in:
Karthikeyan S 2019-05-15 11:38:20 +05:30 committed by Nabin Hait
parent d07a3e1de2
commit c3779851e4

View File

@ -13,9 +13,11 @@ frappe.ui.form.on('HR Settings', {
validate: function(frm) {
let policy = frm.doc.password_policy;
if (policy.includes(' ') || policy.includes('--')) {
frappe.msgprint("Password policy cannot contain spaces or simultaneous hyphens. The format will be restructured automatically");
if (policy) {
if (policy.includes(' ') || policy.includes('--')) {
frappe.msgprint("Password policy cannot contain spaces or simultaneous hyphens. The format will be restructured automatically");
}
frm.set_value('password_policy', policy.split(new RegExp(" |-", 'g')).filter((token) => token).join('-'));
}
frm.set_value('password_policy', policy.split(new RegExp(" |-", 'g')).filter((token) => token).join('-'));
}
});