diff --git a/erpnext/crm/doctype/utils.py b/erpnext/crm/doctype/utils.py index 93ad0932eb..75562dd3b6 100644 --- a/erpnext/crm/doctype/utils.py +++ b/erpnext/crm/doctype/utils.py @@ -42,14 +42,13 @@ def get_last_interaction(number, reference_doc): if query_condition: query_condition = query_condition[:-2] - - last_communication = frappe.db.sql(""" - SELECT `name`, `content` - FROM `tabCommunication` - WHERE {} - ORDER BY `modified` - LIMIT 1 - """.format(query_condition)) + last_communication = frappe.db.sql(""" + SELECT `name`, `content` + FROM `tabCommunication` + WHERE {} + ORDER BY `modified` + LIMIT 1 + """.format(query_condition)) if customer_name: last_issue = frappe.get_all('Issue', { diff --git a/erpnext/erpnext_integrations/exotel_integration.py b/erpnext/erpnext_integrations/exotel_integration.py index 41f8c26252..57cba78bdb 100644 --- a/erpnext/erpnext_integrations/exotel_integration.py +++ b/erpnext/erpnext_integrations/exotel_integration.py @@ -24,13 +24,13 @@ def handle_incoming_call(*args, **kwargs): @frappe.whitelist(allow_guest=True) def handle_end_call(*args, **kwargs): - frappe.publish_realtime('call_disconnected', data=kwargs.get('CallSid')) update_call_log(kwargs, 'Completed') + frappe.publish_realtime('call_disconnected', kwargs.get('CallSid')) @frappe.whitelist(allow_guest=True) def handle_missed_call(*args, **kwargs): - frappe.publish_realtime('call_disconnected', data=kwargs.get('CallSid')) update_call_log(kwargs, 'Missed') + frappe.publish_realtime('call_disconnected', kwargs.get('CallSid')) def update_call_log(call_payload, status): call_log = get_call_log(call_payload, False) diff --git a/erpnext/public/js/call_popup/call_popup.js b/erpnext/public/js/call_popup/call_popup.js index 9ae9fd1eab..c8c4e8b280 100644 --- a/erpnext/public/js/call_popup/call_popup.js +++ b/erpnext/public/js/call_popup/call_popup.js @@ -1,8 +1,7 @@ class CallPopup { - constructor({ call_from, call_log, call_status_method }) { - this.caller_number = call_from; + constructor(call_log) { + this.caller_number = call_log.call_from; this.call_log = call_log; - this.call_status_method = call_status_method; this.make(); } @@ -45,7 +44,7 @@ class CallPopup { const values = this.dialog.get_values(); if (!values.call_summary) return frappe.xcall('erpnext.crm.doctype.utils.add_call_summary', { - 'docname': this.call_log.name, + 'docname': this.call_log.call_id, 'summary': values.call_summary, }).then(() => { this.dialog.set_value('call_summary', ''); @@ -56,10 +55,9 @@ class CallPopup { this.set_call_status(); } }); - this.set_call_status(this.call_log.call_status); + this.set_call_status(); this.make_caller_info_section(); this.dialog.get_close_btn().show(); - this.setup_call_status_updater(); this.dialog.$body.addClass('call-popup'); this.dialog.set_secondary_action(() => { clearInterval(this.updater); @@ -81,7 +79,7 @@ class CallPopup { wrapper.append(`
@@ -89,12 +87,14 @@ class CallPopup { } else { const link = contact.links ? contact.links[0] : null; const contact_link = link ? frappe.utils.get_form_link(link.link_doctype, link.link_name, true): ''; + const contact_name = `${contact.first_name || ''} ${contact.last_name || ''}` wrapper.append(`