fix: added patch for sla enhancements
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index b0421f4..3ea1537 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -694,4 +694,5 @@
 execute:frappe.rename_doc("Desk Page", "Loan Management", "Loan", force=True)
 erpnext.patches.v12_0.update_uom_conversion_factor
 erpnext.patches.v13_0.delete_old_purchase_reports
-erpnext.patches.v12_0.set_italian_import_supplier_invoice_permissions
\ No newline at end of file
+erpnext.patches.v12_0.set_italian_import_supplier_invoice_permissions
+erpnext.patches.v13_0.update_sla_enhancements
\ No newline at end of file
diff --git a/erpnext/patches/v13_0/update_sla_enhancements.py b/erpnext/patches/v13_0/update_sla_enhancements.py
new file mode 100644
index 0000000..1d5f372
--- /dev/null
+++ b/erpnext/patches/v13_0/update_sla_enhancements.py
@@ -0,0 +1,111 @@
+# Copyright (c) 2018, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+
+import frappe
+
+def execute():
+	# add holiday list and employee group fields in SLA
+	# change response and resolution time in priorities child table
+	if frappe.db.exists('DocType', 'Service Level Agreement'):
+		sla_details = frappe.db.get_all('Service Level Agreement', fields=['name', 'service_level'])
+		priorities = frappe.db.get_all('Service Level Priority', fields=['*'], filters={
+			'parenttype': ('in', ['Service Level Agreement', 'Service Level'])
+		})
+
+		frappe.reload_doc('support', 'doctype', 'service_level_agreement')
+		frappe.reload_doc('support', 'doctype', 'service_level_priority')
+
+		for entry in sla_details:
+			values = frappe.db.get_value('Service Level', entry.service_level, ['holiday_list', 'employee_group'])
+			if values:
+				holiday_list = values[0]
+				employee_group = values[1]
+			frappe.db.set_value('Service Level Agreement', entry.name, {
+				'holiday_list': holiday_list,
+				'employee_group': employee_group
+			})
+
+		priority_dict = {}
+
+		for priority in priorities:
+			if priority.parenttype == 'Service Level Agreement':
+				response_time = convert_to_seconds(priority.response_time, priority.response_time_period)
+				resolution_time = convert_to_seconds(priority.resolution_time, priority.resolution_time_period)
+				frappe.db.set_value('Service Level Priority', priority.name, {
+					'response_time': response_time,
+					'resolution_time': resolution_time
+				})
+			if priority.parenttype == 'Service Level':
+				if not priority.parent in priority_dict:
+					priority_dict[priority.parent] = []
+				priority_dict[priority.parent].append(priority)
+
+
+		# copy Service Levels to Service Level Agreements
+		sl = [entry.service_level for entry in sla_details]
+		service_levels = frappe.db.get_all('Service Level', filters={'service_level': ('not in', sl)}, fields=['*'])
+		for entry in service_levels:
+			sla = frappe.new_doc('Service Level Agreement')
+			sla.service_level = entry.service_level
+			sla.holiday_list = entry.holiday_list
+			sla.employee_group = entry.employee_group
+			sla.flags.ignore_validate = True
+			sla = sla.insert(ignore_mandatory=True)
+
+			frappe.db.sql("""
+				UPDATE
+					`tabService Day`
+				SET
+					parent = %(new_parent)s , parentfield = 'support_and_resolution', parenttype = 'Service Level Agreement'
+				WHERE
+					parent = %(old_parent)s
+			""", {'new_parent': sla.name, 'old_parent': entry.name}, as_dict = 1)
+
+			priority_list = priority_dict.get(entry.name)
+			if priority_list:
+				sla = frappe.get_doc('Service Level Agreement', sla.name)
+				for priority in priority_list:
+					row = sla.append('priorities', {
+						'priority': priority.priority,
+						'default_priority': priority.default_priority,
+						'response_time': convert_to_seconds(priority.response_time, priority.response_time_period),
+						'resolution_time': convert_to_seconds(priority.resolution_time, priority.resolution_time_period)
+					})
+					row.db_update()
+				sla.db_update()
+
+	# set issue status as Replied since Hold status is removed
+	if frappe.db.exists('DocType', 'Issue'):
+		issues_on_hold = frappe.db.sql("""
+			SELECT
+				name
+			FROM
+				`tabIssue`
+			WHERE
+				status = 'Hold'
+		""", as_dict=1)
+
+		issues = [entry.name for entry in issues_on_hold]
+
+		frappe.reload_doc('support', 'doctype', 'issue')
+		frappe.db.sql("""
+			UPDATE
+				`tabIssue`
+			SET
+				status='Replied'
+			WHERE
+				name in %(issues)s
+		""", {'issues': issues}, debug=1)
+
+
+def convert_to_seconds(value, unit):
+	seconds = 0
+	if unit == "Hour":
+		seconds = value * 3600
+	if unit == "Day":
+		seconds = value * 3600 * 24
+	if unit == "Week":
+		seconds = value * 3600 * 24 * 7
+	return seconds