Fixes in support ticket attachments
This commit is contained in:
parent
c50f605450
commit
7a4d9dbd3e
@ -33,7 +33,6 @@ class SupportMailbox(POP3Mailbox):
|
|||||||
Updates message from support email as either new or reply
|
Updates message from support email as either new or reply
|
||||||
"""
|
"""
|
||||||
from home import update_feed
|
from home import update_feed
|
||||||
from webnotes.utils.file_manager import save_file, add_file_list
|
|
||||||
|
|
||||||
content, content_type = '[Blank Email]', 'text/plain'
|
content, content_type = '[Blank Email]', 'text/plain'
|
||||||
if mail.text_content:
|
if mail.text_content:
|
||||||
@ -51,7 +50,7 @@ class SupportMailbox(POP3Mailbox):
|
|||||||
webnotes.conn.set(st.doc, 'status', 'Open')
|
webnotes.conn.set(st.doc, 'status', 'Open')
|
||||||
update_feed(st.doc)
|
update_feed(st.doc)
|
||||||
# extract attachments
|
# extract attachments
|
||||||
self.save_attachments(doc=st.doc, attachment_list=mail.attachments)
|
self.save_attachments(st.doc, mail.attachments)
|
||||||
return
|
return
|
||||||
|
|
||||||
# new ticket
|
# new ticket
|
||||||
@ -77,7 +76,7 @@ class SupportMailbox(POP3Mailbox):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
# extract attachments
|
# extract attachments
|
||||||
self.save_attachments(doc=d, attachment_list=mail.attachments)
|
self.save_attachments(d, mail.attachments)
|
||||||
|
|
||||||
|
|
||||||
def save_attachments(self, doc, attachment_list=[]):
|
def save_attachments(self, doc, attachment_list=[]):
|
||||||
@ -87,17 +86,16 @@ class SupportMailbox(POP3Mailbox):
|
|||||||
attachment_list is a list of dict containing:
|
attachment_list is a list of dict containing:
|
||||||
'filename', 'content', 'content-type'
|
'filename', 'content', 'content-type'
|
||||||
"""
|
"""
|
||||||
|
from webnotes.utils.file_manager import save_file, add_file_list
|
||||||
for attachment in attachment_list:
|
for attachment in attachment_list:
|
||||||
fid = save_file(
|
webnotes.conn.begin()
|
||||||
fname=attachment['filename'],
|
fid = save_file(attachment['filename'], attachment['content'], 'Support')
|
||||||
content=attachment['content'],
|
|
||||||
module='Support'
|
|
||||||
)
|
|
||||||
status = add_file_list('Support Ticket', doc.name, attachment['filename'], fid)
|
status = add_file_list('Support Ticket', doc.name, attachment['filename'], fid)
|
||||||
if not status:
|
if not status:
|
||||||
doc.description = doc.description \
|
doc.description = doc.description \
|
||||||
+ "\nCould not attach: " + str(attachment['filename'])
|
+ "\nCould not attach: " + str(attachment['filename'])
|
||||||
doc.save()
|
doc.save()
|
||||||
|
webnotes.conn.commit()
|
||||||
|
|
||||||
|
|
||||||
def send_auto_reply(self, d):
|
def send_auto_reply(self, d):
|
||||||
|
Loading…
Reference in New Issue
Block a user