# Copyright (c) 2018, XhiveFramework Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE

import xhiveframework


def execute():
	signatures = xhiveframework.db.get_list("User", {"email_signature": ["!=", ""]}, ["name", "email_signature"])
	xhiveframework.reload_doc("core", "doctype", "user")
	for d in signatures:
		signature = d.get("email_signature")
		signature = signature.replace("\n", "<br>")
		signature = "<div>" + signature + "</div>"
		xhiveframework.db.set_value("User", d.get("name"), "email_signature", signature)
