# Copyright (c) 2018, InfluxFramework LLC
# License: MIT. See LICENSE

import influxframework


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