fixed conflict

This commit is contained in:
Nabin Hait
2011-07-26 15:46:10 +05:30
16 changed files with 291 additions and 273 deletions

View File

@@ -6,14 +6,26 @@ class SupportMailbox(POP3Mailbox):
def __init__(self):
"""
settings_doc must contain
is_ssl, host, username, password
use_ssl, host, username, password
"""
POP3Mailbox.__init__(self, 'Support Email Settings')
from webnotes.model.doc import Document
# extract email settings
self.email_settings = Document('Email Settings','Email Settings')
s = Document('Support Email Settings')
s.use_ssl = self.email_settings.support_use_ssl
s.host = self.email_settings.support_host
s.username = self.email_settings.support_username
s.password = self.email_settings.support_password
POP3Mailbox.__init__(self, s)
def check_mails(self):
"""
returns true if there are active sessions
"""
self.auto_close_tickets()
return webnotes.conn.sql("select user from tabSessions where time_to_sec(timediff(now(), lastupdate)) < 1800")
def process_message(self, mail):
@@ -56,6 +68,39 @@ class SupportMailbox(POP3Mailbox):
# update feed
update_feed(d)
# send auto reply
self.send_auto_reply(d)
def send_auto_reply(self, d):
"""
Send auto reply to emails
"""
signature = self.email_settings.support_signature
response = self.email_settings.support_autoreply or ("""
A new Ticket has been raised for your query. If you have any additional information, please
reply back to this mail.
We will get back to you as soon as possible
[This is an automatic response]
""" + signature)
from webnotes.utils.email_lib import sendmail
sendmail(\
recipients = [d.raised_by], \
sender = self.email_settings.support_email, \
subject = '['+d.name+'] ' + d.subject, \
msg = response)
def auto_close_tickets(self):
"""
Auto Closes Waiting for Customer Support Ticket after 15 days
"""
webnotes.conn.sql("update `tabSupport Ticket` set status = 'Closed' where status = 'Waiting for Customer' and date_sub(curdate(),interval 15 Day) > modified")
def get_support_mails():
"""
@@ -63,8 +108,3 @@ def get_support_mails():
"""
SupportMailbox().get_messages()
def auto_close_tickets():
"""
Auto Closes Waiting for Customer Support Ticket after 15 days
"""
webnotes.conn.sql("update `tabSupport Ticket` set status = 'Closed' where status = 'Waiting for Customer' and date_sub(curdate(),interval 15 Day) > modified")

View File

@@ -20,9 +20,9 @@ $.extend(cur_frm.cscript, {
items: [
{
column: 0,
label:'Support Email Settings',
label:'Email Settings',
description:'Integrate your incoming support emails to support ticket',
onclick: function() { loaddoc('Support Email Settings','Support Email Settings'); }
onclick: function() { loaddoc('Email Settings','Email Settings'); }
},
]
})

View File

@@ -19,7 +19,7 @@ class DocType(TransactionBase):
response = self.doc.new_response + '\n\n[Please do not change the subject while responding.]'
signature = webnotes.conn.get_value('Support Email Settings',None,'signature')
signature = webnotes.conn.get_value('Email Settings',None,'support_signature')
if signature:
response += '\n\n' + signature
@@ -27,7 +27,7 @@ class DocType(TransactionBase):
sendmail(\
recipients = [self.doc.raised_by], \
sender=webnotes.conn.get_value('Support Email Settings',None,'email'), \
sender=webnotes.conn.get_value('Email Settings',None,'support_email'), \
subject=subject, \
msg=response)

View File

@@ -3,16 +3,16 @@
# These values are common in all dictionaries
{
'creation': '2011-05-23 14:50:46',
'creation': '2011-05-23 09:01:10',
'docstatus': 0,
'modified': '2011-07-06 09:25:53',
'modified': '2011-07-25 14:45:28',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'_last_update': '1309771514',
'_last_update': '1311584009',
'allow_trash': 1,
'autoname': 'SUP.######',
'colour': 'White:FFF',
@@ -25,7 +25,7 @@
'show_in_menu': 0,
'subject': '%(subject)s',
'tag_fields': 'status,allocated_to',
'version': 150
'version': 144
},
# These values are common for all DocField
@@ -131,7 +131,7 @@
{
'doctype': 'DocField',
'fieldname': 'subject',
'fieldtype': 'Small Text',
'fieldtype': 'Text',
'idx': 2,
'in_filter': 1,
'label': 'Subject',
@@ -168,24 +168,12 @@
'reqd': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'problem_description',
'fieldtype': 'Text',
'idx': 5,
'label': 'Problem Description',
'oldfieldname': 'problem_description',
'oldfieldtype': 'Text',
'permlevel': 0
},
# DocField
{
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldtype': 'HTML',
'idx': 6,
'idx': 5,
'label': 'Thread HTML',
'permlevel': 1
},
@@ -196,7 +184,7 @@
'doctype': 'DocField',
'fieldname': 'new_response',
'fieldtype': 'Text',
'idx': 7,
'idx': 6,
'label': 'New Response',
'permlevel': 0
},
@@ -206,9 +194,8 @@
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 8,
'idx': 7,
'label': 'Send',
'options': 'send_response',
'permlevel': 0
},
@@ -217,7 +204,7 @@
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 9,
'idx': 8,
'label': 'Additional Info',
'permlevel': 1
},
@@ -227,7 +214,7 @@
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 10,
'idx': 9,
'oldfieldtype': 'Column Break',
'permlevel': 1,
'width': '50%'
@@ -239,7 +226,7 @@
'doctype': 'DocField',
'fieldname': 'customer',
'fieldtype': 'Link',
'idx': 11,
'idx': 10,
'in_filter': 1,
'label': 'Customer',
'oldfieldname': 'customer',
@@ -257,7 +244,7 @@
'doctype': 'DocField',
'fieldname': 'customer_name',
'fieldtype': 'Data',
'idx': 12,
'idx': 11,
'in_filter': 1,
'label': 'Customer Name',
'oldfieldname': 'customer_name',
@@ -272,7 +259,7 @@
'doctype': 'DocField',
'fieldname': 'address_display',
'fieldtype': 'Small Text',
'idx': 13,
'idx': 12,
'label': 'Address',
'permlevel': 2
},
@@ -282,7 +269,7 @@
'doctype': 'DocField',
'fieldname': 'contact_display',
'fieldtype': 'Data',
'idx': 14,
'idx': 13,
'label': 'Contact Name',
'permlevel': 2
},
@@ -292,7 +279,7 @@
'doctype': 'DocField',
'fieldname': 'contact_mobile',
'fieldtype': 'Data',
'idx': 15,
'idx': 14,
'label': 'Mobile No',
'permlevel': 2
},
@@ -302,7 +289,7 @@
'doctype': 'DocField',
'fieldname': 'contact_email',
'fieldtype': 'Data',
'idx': 16,
'idx': 15,
'label': 'Contact Email',
'oldfieldname': 'contact_no',
'oldfieldtype': 'Data',
@@ -315,7 +302,7 @@
'doctype': 'DocField',
'fieldname': 'opening_date',
'fieldtype': 'Date',
'idx': 17,
'idx': 16,
'label': 'Opening Date',
'no_copy': 1,
'oldfieldname': 'opening_date',
@@ -328,7 +315,7 @@
'doctype': 'DocField',
'fieldname': 'opening_time',
'fieldtype': 'Time',
'idx': 18,
'idx': 17,
'label': 'Opening Time',
'no_copy': 1,
'oldfieldname': 'opening_time',
@@ -341,19 +328,18 @@
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 19,
'idx': 18,
'oldfieldtype': 'Column Break',
'permlevel': 1
},
# DocField
{
'colour': 'White:FFF',
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldname': 'allocated_to',
'fieldtype': 'Link',
'idx': 20,
'idx': 19,
'in_filter': 1,
'label': 'Allocated To',
'oldfieldname': 'allocated_to',
@@ -368,8 +354,8 @@
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldname': 'resolution_details',
'fieldtype': 'Small Text',
'idx': 21,
'fieldtype': 'Text',
'idx': 20,
'label': 'Resolution Details',
'no_copy': 1,
'oldfieldname': 'resolution_details',
@@ -379,12 +365,11 @@
# DocField
{
'colour': 'White:FFF',
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldname': 'resolution_date',
'fieldtype': 'Date',
'idx': 22,
'idx': 21,
'in_filter': 0,
'label': 'Resolution Date',
'no_copy': 1,
@@ -400,7 +385,7 @@
'doctype': 'DocField',
'fieldname': 'resolution_time',
'fieldtype': 'Time',
'idx': 23,
'idx': 22,
'label': 'Resolution Time',
'oldfieldname': 'resolution_time',
'oldfieldtype': 'Time',
@@ -414,7 +399,7 @@
'fieldname': 'content_type',
'fieldtype': 'Data',
'hidden': 1,
'idx': 24,
'idx': 23,
'label': 'Content Type',
'permlevel': 0
}