fix(patch): skip leave ledger entry creation for denied leaves (#19579)

diff --git a/erpnext/patches/v12_0/remove_denied_leaves_from_leave_ledger.py b/erpnext/patches/v12_0/remove_denied_leaves_from_leave_ledger.py
index 24f0e7c..7859606 100644
--- a/erpnext/patches/v12_0/remove_denied_leaves_from_leave_ledger.py
+++ b/erpnext/patches/v12_0/remove_denied_leaves_from_leave_ledger.py
@@ -19,8 +19,10 @@
 	return frappe.db.sql_list(''' Select name from `tabLeave Application` where status <> 'Approved' ''')
 
 def delete_denied_leaves_from_leave_ledger_entry(leave_application_list):
-	frappe.db.sql(''' Delete
-		FROM `tabLeave Ledger Entry`
-		WHERE
-			transaction_type = 'Leave Application'
-			AND transaction_name in {0} '''.format(tuple(leave_application_list))) #nosec
\ No newline at end of file
+	if leave_application_list:
+		frappe.db.sql(''' Delete
+			FROM `tabLeave Ledger Entry`
+			WHERE
+				transaction_type = 'Leave Application'
+				AND transaction_name in (%s) ''' % (', '.join(['%s'] * len(leave_application_list))), #nosec
+				tuple(leave_application_list))
\ No newline at end of file