Modify Email Signature fieldtype (#6161)

- Change fieldtype from Text to Text Editor
- Add patch to handle cases having a new line
This commit is contained in:
Shreya Shah 2018-10-02 10:41:03 +05:30 committed by Rushabh Mehta
parent 0e65150b87
commit b7d8f23a8b
3 changed files with 16 additions and 2 deletions

View file

@ -1217,7 +1217,7 @@
"collapsible": 0,
"columns": 0,
"fieldname": "email_signature",
"fieldtype": "Small Text",
"fieldtype": "Text Editor",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@ -2206,7 +2206,7 @@
"istable": 0,
"max_attachments": 5,
"menu_index": 0,
"modified": "2018-08-15 12:12:06.215199",
"modified": "2018-09-28 16:34:06.215199",
"modified_by": "Administrator",
"module": "Core",
"name": "User",

View file

@ -12,6 +12,7 @@ execute:frappe.reload_doc('core', 'doctype', 'docperm') #2018-05-29
frappe.patches.v8_0.drop_is_custom_from_docperm
execute:frappe.reload_doc('core', 'doctype', 'module_def') #2017-09-22
execute:frappe.reload_doc('core', 'doctype', 'version') #2017-04-01
frappe.patches.v11_0.change_email_signature_fieldtype
frappe.patches.v11_0.copy_fetch_data_from_options
frappe.patches.v7_1.rename_scheduler_log_to_error_log
frappe.patches.v6_1.rename_file_data

View file

@ -0,0 +1,13 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
import frappe
def execute():
signatures = frappe.db.get_list('User', {'email_signature': ['!=', '']},['name', 'email_signature'])
frappe.reload_doc('core', 'doctype', 'user')
for d in signatures:
signature = d.get('email_signature')
signature = signature.replace('\n', '<br>')
signature = '<div>' + signature + '</div>'
frappe.db.set_value('User', d.get('name'), 'email_signature', signature)