diff --git a/frappe/core/doctype/communication/comment.py b/frappe/core/doctype/communication/comment.py index f639c35ff0..bf4d1b0f46 100644 --- a/frappe/core/doctype/communication/comment.py +++ b/frappe/core/doctype/communication/comment.py @@ -39,6 +39,8 @@ def update_comment_in_doc(doc): """Updates `_comments` (JSON) property in parent Document. Creates a column `_comments` if property does not exist. + Only user created comments Communication or Comment of type Comment are saved. + `_comments` format { @@ -47,15 +49,19 @@ def update_comment_in_doc(doc): "name": [Comment Document name] }""" - if doc.communication_type != "Comment": + if doc.communication_type not in ("Comment", "Communication"): return - if doc.reference_doctype and doc.reference_name and doc.content and doc.comment_type=="Comment": + if doc.communication_type == 'Comment' and doc.comment_type != 'Comment': + # other updates + return + + if doc.reference_doctype and doc.reference_name and doc.content: _comments = get_comments_from_parent(doc) updated = False for c in _comments: if c.get("name")==doc.name: - c["comment"] = doc.content + c["comment"] = (doc.content[:97] + '...') if len(doc.content) > 100 else doc.content updated = True if not updated: @@ -64,6 +70,7 @@ def update_comment_in_doc(doc): "by": doc.sender or doc.owner, "name": doc.name }) + update_comments_in_parent(doc.reference_doctype, doc.reference_name, _comments) def notify_mentions(doc): diff --git a/frappe/desk/form/load.py b/frappe/desk/form/load.py index d5d2442c66..6e9797c453 100644 --- a/frappe/desk/form/load.py +++ b/frappe/desk/form/load.py @@ -134,7 +134,7 @@ def _get_communications(doctype, name, start=0, limit=20): def get_communication_data(doctype, name, start=0, limit=20, after=None, fields=None, group_by=None, as_dict=True): - '''Returns list of communicataions for a given document''' + '''Returns list of communications for a given document''' if not fields: fields = '''name, communication_type, communication_medium, comment_type, diff --git a/frappe/model/delete_doc.py b/frappe/model/delete_doc.py index 2e02fb109e..66aaf5e999 100644 --- a/frappe/model/delete_doc.py +++ b/frappe/model/delete_doc.py @@ -86,7 +86,7 @@ def delete_doc(doctype=None, name=None, force=0, ignore_doctypes=None, for_reloa delete_email_subscribe(doc) # check if links exist - if not force: + if not force and doc.doctype not in ("ToDo", "Communication", "DocShare", "Email Unsubscribe"): check_if_doc_is_linked(doc) check_if_doc_is_dynamically_linked(doc) @@ -165,7 +165,7 @@ def check_if_doc_is_linked(doc, method="Delete"): # linked to an non-cancelled doc when deleting # or linked to a submitted doc when cancelling frappe.throw(_("Cannot delete or cancel because {0} {1} is linked with {2} {3}") - .format(doc.doctype, doc.name, item.parenttype if item.parent else link_dt, + .format(doc.doctype, doc.name, item.parenttype if item.parent else link_dt, item.parent or item.name), frappe.LinkExistsError) def check_if_doc_is_dynamically_linked(doc, method="Delete"): diff --git a/frappe/patches.txt b/frappe/patches.txt index 91a2f3537a..d8776aab43 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -123,4 +123,5 @@ frappe.patches.v6_24.sync_desktop_icons frappe.patches.v6_20x.set_allow_draft_for_print frappe.patches.v6_20x.remove_roles_from_website_user frappe.patches.v7_0.set_user_fullname -frappe.patches.v7_0.desktop_icons_hidden_by_admin_as_blocked \ No newline at end of file +frappe.patches.v7_0.desktop_icons_hidden_by_admin_as_blocked +frappe.patches.v7_0.add_communication_in_doc diff --git a/frappe/patches/v7_0/add_communication_in_doc.py b/frappe/patches/v7_0/add_communication_in_doc.py new file mode 100644 index 0000000000..c25052877c --- /dev/null +++ b/frappe/patches/v7_0/add_communication_in_doc.py @@ -0,0 +1,9 @@ +import frappe + +from frappe.core.doctype.communication.comment import update_comment_in_doc + +def execute(): + for d in frappe.db.get_all("Communication", + fields = ['name', 'reference_doctype', 'reference_name', 'content', 'communication_type'], + filters = {'communication_type': 'Communication'}): + update_comment_in_doc(d) \ No newline at end of file diff --git a/frappe/templates/includes/login/login.css b/frappe/templates/includes/login/login.css index 6cbe2ce18e..ae6a1e29d6 100644 --- a/frappe/templates/includes/login/login.css +++ b/frappe/templates/includes/login/login.css @@ -8,12 +8,12 @@ } .blue { - color: #7575ff; + color: #7575ff; } .icon-facebook, .icon-facebook-sign{ color: #3b5998; -} +} .icon-google-plus, .icon-google-plus-sign{ color: #C63D2D; } @@ -37,7 +37,7 @@ max-width: 360px; padding-right: 30px; padding-left: 30px; - padding-top: 10px; + padding-top: 50px; margin: 0 auto; border-radius: 5px; background-color: #fff;