mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-02 21:18:27 +00:00
fixed conflict
This commit is contained in:
@@ -1,44 +1,42 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
from webnotes.utils import cint, cstr
|
||||
|
||||
class DocType:
|
||||
def __init__(self,doc,doclist):
|
||||
self.doc,self.doclist = doc,doclist
|
||||
def __init__(self,doc,doclist):
|
||||
self.doc,self.doclist = doc,doclist
|
||||
|
||||
def set_vals(self):
|
||||
res = sql("select field, value from `tabSingles` where doctype = 'Control Panel' and field IN ('outgoing_mail_server','mail_login','mail_password','auto_email_id','mail_port','use_ssl')")
|
||||
ret = {}
|
||||
for r in res:
|
||||
ret[cstr(r[0])]=r[1] and cstr(r[1]) or ''
|
||||
|
||||
return str(ret)
|
||||
def set_vals(self):
|
||||
res = sql("select field, value from `tabSingles` where doctype = 'Control Panel' and field IN ('outgoing_mail_server','mail_login','mail_password','auto_email_id','mail_port','use_ssl')")
|
||||
ret = {}
|
||||
for r in res:
|
||||
ret[cstr(r[0])]=r[1] and cstr(r[1]) or ''
|
||||
|
||||
return str(ret)
|
||||
|
||||
def on_update(self):
|
||||
if self.doc.outgoing_mail_server:
|
||||
sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'outgoing_mail_server'"%self.doc.outgoing_mail_server)
|
||||
if self.doc.mail_login:
|
||||
sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'mail_login'"%self.doc.mail_login)
|
||||
if self.doc.mail_password:
|
||||
sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'mail_password'"%self.doc.mail_password)
|
||||
if self.doc.auto_email_id:
|
||||
sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'auto_email_id'"%self.doc.auto_email_id)
|
||||
if self.doc.mail_port:
|
||||
sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'mail_port'"%self.doc.mail_port)
|
||||
if self.doc.use_ssl:
|
||||
sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'use_ssl'"%self.doc.use_ssl)
|
||||
def set_cp_value(self, key):
|
||||
"""
|
||||
Update value in control panel
|
||||
"""
|
||||
if self.doc.fields.get(key):
|
||||
webnotes.conn.set_value('Control Panel', None, key, self.doc.fields[key])
|
||||
|
||||
def on_update(self):
|
||||
"""
|
||||
Sets or cancels the event in the scheduler
|
||||
"""
|
||||
# update control panel
|
||||
for f in ('outgoing_mail_server', 'mail_login', 'mail_password', 'auto_email_id', 'mail_port', 'use_ssl'):
|
||||
self.set_cp_value(f)
|
||||
|
||||
# setup scheduler for support emails
|
||||
if cint(self.doc.sync_support_mails):
|
||||
if not (self.doc.support_host and self.doc.support_username and self.doc.support_password):
|
||||
webnotes.msgprint("You must give the incoming POP3 settings for support emails to activiate mailbox integration", raise_exception=1)
|
||||
|
||||
from webnotes.utils.scheduler import set_event
|
||||
set_event('support.doctype.support_ticket.get_support_mails', 60*5, 1)
|
||||
else:
|
||||
from webnotes.utils.scheduler import cancel_event
|
||||
cancel_event('support.doctype.support_ticket.get_support_mails')
|
||||
@@ -5,14 +5,14 @@
|
||||
{
|
||||
'creation': '2010-08-08 17:08:59',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-01-04 11:21:25',
|
||||
'modified_by': 'umair@iwebnotes.com',
|
||||
'modified': '2011-07-25 15:03:51',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'harshada@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1307707462',
|
||||
'_last_update': '1311586371',
|
||||
'allow_copy': 1,
|
||||
'allow_email': 1,
|
||||
'allow_print': 1,
|
||||
@@ -24,7 +24,7 @@
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'version': 27
|
||||
'version': 34
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@@ -69,12 +69,29 @@
|
||||
'idx': 2
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 1,
|
||||
'label': 'Outgoing Mails'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 2,
|
||||
'label': '1',
|
||||
'options': '<div class="help_box">Set your outgoing mail settings here. All system generated notifications, emails will go from this mail server</div>'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'outgoing_mail_server',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 1,
|
||||
'idx': 3,
|
||||
'label': 'Outgoing Mail Server'
|
||||
},
|
||||
|
||||
@@ -83,7 +100,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'mail_port',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'idx': 4,
|
||||
'label': 'Mail Port'
|
||||
},
|
||||
|
||||
@@ -92,7 +109,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'use_ssl',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 3,
|
||||
'idx': 5,
|
||||
'label': 'Use SSL'
|
||||
},
|
||||
|
||||
@@ -101,7 +118,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'mail_login',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 4,
|
||||
'idx': 6,
|
||||
'label': 'Login Id'
|
||||
},
|
||||
|
||||
@@ -110,7 +127,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'mail_password',
|
||||
'fieldtype': 'Password',
|
||||
'idx': 5,
|
||||
'idx': 7,
|
||||
'label': 'Mail Password'
|
||||
},
|
||||
|
||||
@@ -119,7 +136,122 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'auto_email_id',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 6,
|
||||
'idx': 8,
|
||||
'label': 'Auto Email Id'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': 'Set the POP3 email settings to pull emails directly from a mailbox and create Support Tickets',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 9,
|
||||
'label': 'Support Ticket Mail Settings'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 10,
|
||||
'label': '2',
|
||||
'options': '<div class="help_box">To automatically create Support Tickets from your incoming mail, set your pop3 settings here.</div>'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 11,
|
||||
'options': 'Simple'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Check this to pull emails from your mailbox',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'sync_support_mails',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 12,
|
||||
'label': 'Sync Support Mails'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Your support email id - must be a valid email - this is where your emails will come!',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'support_email',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 13,
|
||||
'label': 'Support Email'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'POP3 mail server (e.g. pop.gmail.com)',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'support_host',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 14,
|
||||
'label': 'POP3 Mail Server'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'support_use_ssl',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 15,
|
||||
'label': 'Use SSL'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'support_username',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 16,
|
||||
'label': 'User Name'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'support_password',
|
||||
'fieldtype': 'Password',
|
||||
'idx': 17,
|
||||
'label': 'Support Password'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 18
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Signature to be appended at the end of every email',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'support_signature',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 19,
|
||||
'label': 'Signature'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Autoreply when a new mail is received',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'support_autoreply',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 20,
|
||||
'label': 'Autoreply'
|
||||
}
|
||||
]
|
||||
@@ -13,7 +13,6 @@ sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
@@ -37,9 +36,11 @@ class DocType:
|
||||
#-----------------------
|
||||
def set_account_details(self, args):
|
||||
args = eval(args)
|
||||
#webnotes.logger.error("args in set_account_details of setup_control: " + str(args))
|
||||
|
||||
self.set_cp_defaults(args['company'], args['industry'], args['time_zone'], args['country'], args['account_name'])
|
||||
self.create_profile(args['user'], args['first_name'], args['last_name'])
|
||||
|
||||
from server_tools.gateway_utils import update_client_control
|
||||
update_client_control(args['total_users'])
|
||||
|
||||
|
||||
@@ -182,7 +183,7 @@ class DocType:
|
||||
Validates if setup has been performed after database allocation
|
||||
"""
|
||||
|
||||
from server_tools.gateway_utils import update_client_control, get_total_users
|
||||
from server_tools.gateway_utils import get_total_users
|
||||
|
||||
args = eval(args)
|
||||
#webnotes.logger.error("args in set_account_details of setup_control: " + str(args))
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import webnotes
|
||||
from webnotes.utils import cint
|
||||
|
||||
class DocType:
|
||||
def __init__(self,dt,dn):
|
||||
self.doc, self.doctype = dt,dn
|
||||
|
||||
def on_update(self):
|
||||
"""
|
||||
Sets or cancels the event in the scheduler
|
||||
"""
|
||||
if cint(self.doc.integrate_incoming):
|
||||
from webnotes.utils.scheduler import set_event
|
||||
set_event('support.doctype.support_ticket.get_support_mails', 60*5, 1)
|
||||
else:
|
||||
from webnotes.utils.scheduler import cancel_event
|
||||
cancel_event('support.doctype.support_ticket.get_support_mails')
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
# DocType, Support Email Settings
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2011-05-23 14:50:45',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-05-28 09:25:53',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1306554355',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'in_dialog': 1,
|
||||
'issingle': 1,
|
||||
'module': 'Setup',
|
||||
'name': '__common__',
|
||||
'read_only': 1,
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 1,
|
||||
'version': 8
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Support Email Settings',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'name': '__common__',
|
||||
'parent': 'Support Email Settings',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'System Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocType, Support Email Settings
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Support Email Settings'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'The full email id of your incoming support emails',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'email',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 1,
|
||||
'label': 'Email',
|
||||
'options': 'Email'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'By checking this, your incoming mails will automatically be integrated with the Support Ticket',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'integrate_incoming',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 2,
|
||||
'label': 'Integrate Incoming'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Signature appended to the outgoing email (Text / HTML)',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'signature',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 3,
|
||||
'label': 'Signature'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 4
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'use_ssl',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 5,
|
||||
'label': 'Use SSL'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'eg. pop.gmail.com',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'host',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 6,
|
||||
'label': 'Host'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Support Email Id',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'username',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 7,
|
||||
'label': 'Username'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'password',
|
||||
'fieldtype': 'Password',
|
||||
'idx': 8,
|
||||
'label': 'Password'
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user