Fix regarding support ticket to support ticket system email chaining issue

This commit is contained in:
Anand Doshi 2012-01-05 13:54:29 +05:30
parent 5e57a39bb1
commit 9dfc9f617b

View File

@ -40,9 +40,23 @@ class SupportMailbox(POP3Mailbox):
else: else:
content, content_type = mail.html_content, 'text/html' content, content_type = mail.html_content, 'text/html'
thread_id = mail.get_thread_id() thread_list = mail.get_thread_id()
if webnotes.conn.exists('Support Ticket', thread_id):
email_id = mail.mail['From']
if "<" in mail.mail['From']:
import re
re_result = re.findall('(?<=\<)(\S+)(?=\>)', mail.mail['From'])
if re_result and re_result[0]: email_id = res_result[0]
for thread_id in thread_list:
exists = webnotes.conn.sql("""\
SELECT name
FROM `tabSupport Ticket`
WHERE name=%s AND raised_by LIKE %s
""", (thread_id, "%" + email_id + "%"))
if exists and exists[0] and exists[0][0]:
from webnotes.model.code import get_obj from webnotes.model.code import get_obj
st = get_obj('Support Ticket', thread_id) st = get_obj('Support Ticket', thread_id)