From 02c93a3d05539756b5f8fdfc7ee90aec4f14480c Mon Sep 17 00:00:00 2001 From: Shridhar Patil Date: Tue, 24 Apr 2018 14:45:11 +0530 Subject: [PATCH] [bug] Leave application ui issues fixed (#13740) * validate to_date in leave application if to_date is less than from_date show message to user reset to_date value to '' * var declaration and semicolon missed * Updated popup message --- .../hr/doctype/leave_application/leave_application.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/erpnext/hr/doctype/leave_application/leave_application.js b/erpnext/hr/doctype/leave_application/leave_application.js index 085fa3c842..242c987e58 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.js +++ b/erpnext/hr/doctype/leave_application/leave_application.js @@ -110,6 +110,15 @@ frappe.ui.form.on("Leave Application", { calculate_total_days: function(frm) { if(frm.doc.from_date && frm.doc.to_date && frm.doc.employee && frm.doc.leave_type) { + + var from_date = Date.parse(frm.doc.from_date); + var to_date = Date.parse(frm.doc.to_date); + + if(to_date < from_date){ + frappe.msgprint(__("To Date cannot be less than From Date")); + frm.set_value('to_date', ''); + return; + } // server call is done to include holidays in leave days calculations return frappe.call({ method: 'erpnext.hr.doctype.leave_application.leave_application.get_number_of_leave_days',