Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Rushabh Mehta 2012-11-26 10:19:22 +01:00
commit 2d0f78cb54
7 changed files with 53 additions and 57 deletions

View File

@ -1,4 +1,8 @@
erpnext.updates = [
["26th November 2012", [
"Email: Added User Signature",
"Support Ticket: Added link to Lead / Contact. If incoming ticket is not from an existing Lead / Contact, create a new Lead",
]],
["24ht November 2012", [
"Support Ticket: Support Ticket Response is now Communication",
]],

View File

@ -70,6 +70,8 @@ MyProfile = function(wrapper) {
fields: [
{fieldname:'first_name', fieldtype:'Data',label:'First Name',reqd:1},
{fieldname:'last_name', fieldtype:'Data',label:'Last Name'},
{fieldname:'email_signature', fieldtype:'Text',label:'Email Signature',
decription:'Will be appended to outgoing mail'},
{fieldname:'bio', fieldtype:'Text',label:'Bio'},
{fieldname:'update', fieldtype:'Button',label:'Update'}
]

View File

@ -63,6 +63,7 @@ def set_user_details(arg=None):
arg_dict = load_json(arg)
if not 'bio' in arg_dict: arg_dict['bio'] = None
if not 'last_name' in arg_dict: arg_dict['last_name'] = None
if not 'email_signature' in arg_dict: arg_dict['email_signature'] = None
p.fields.update(arg_dict)
p.save()
webnotes.msgprint('Updated')

View File

@ -22,7 +22,7 @@ erpnext.toolbar.setup = function() {
erpnext.toolbar.add_modules();
// profile
$('#toolbar-user').append('<li><a href="#!profile-settings">Profile Settings</a></li>');
$('#toolbar-user').append('<li><a href="#!profile-settings">My Settings...</a></li>');
$('.navbar .pull-right').append('\
<li><a href="#!messages" title="Unread Messages"><span class="navbar-new-comments"></span></a></li>');

View File

@ -4,7 +4,7 @@
"docstatus": 0,
"creation": "2012-11-14 12:25:16",
"modified_by": "Administrator",
"modified": "2012-11-26 11:17:28"
"modified": "2012-11-26 12:41:59"
},
{
"autoname": "naming_series:",
@ -12,7 +12,7 @@
"name": "__common__",
"doctype": "DocType",
"module": "Support",
"in_dialog": 1,
"in_dialog": 0,
"document_type": "Master",
"description": "Keep a track of all communications"
},

View File

@ -100,28 +100,45 @@ class DocType(TransactionBase):
Creates a new Communication record
"""
# add to Communication
import email.utils
d = webnotes.doc('Communication')
d.subject = self.doc.subject
d.email_address = from_email or webnotes.user.name
email_addr = email.utils.parseaddr(d.email_address)[1]
d.contact = webnotes.conn.get_value("Contact", {"email_id": email_addr}, "name") or None
d.lead = webnotes.conn.get_value("Lead", {"email_id": email_addr}, "name") or None
self.set_lead_and_contact(d)
d.support_ticket = self.doc.name
d.content = response
d.communication_medium = "Email"
d.save(1)
if not d.lead and not d.contact:
self.make_lead(d, email_addr[0])
def set_lead_and_contact(self, d):
import email.utils
email_addr = email.utils.parseaddr(d.email_address)
# set contact
if self.doc.contact:
d.contact = self.doc.contact
else:
d.contact = webnotes.conn.get_value("Contact", {"email_id": email_addr[1]}, "name") or None
if d.contact:
webnotes.conn.set(self.doc, "contact", d.contact)
if self.doc.lead:
d.lead = self.doc.lead
else:
d.lead = webnotes.conn.get_value("Lead", {"email_id": email_addr[1]}, "name") or None
if d.lead:
webnotes.conn.set(self.doc, "lead", d.lead)
# not linked to any lead / contact, create new lead
if not d.lead and not d.contact:
d.lead = self.make_lead(d, email_addr[0])
webnotes.conn.set(self.doc, "lead", d.lead)
def make_lead(self, d, real_name):
d = webnotes.doc("Lead")
d.lead_name = real_name or d.email_address
d.email_id = d.email_address
d.source = "Email"
d.save(1)
return d.name
def close_ticket(self):
webnotes.conn.set(self.doc,'status','Closed')

View File

@ -4,7 +4,7 @@
"docstatus": 0,
"creation": "2012-11-02 17:17:05",
"modified_by": "Administrator",
"modified": "2012-11-26 11:17:10"
"modified": "2012-11-26 12:54:25"
},
{
"autoname": "naming_series:",
@ -138,6 +138,22 @@
"depends_on": "eval:!doc.__islocal",
"permlevel": 1
},
{
"doctype": "DocField",
"label": "Lead",
"options": "Lead",
"fieldname": "lead",
"fieldtype": "Link",
"permlevel": 0
},
{
"doctype": "DocField",
"label": "Contact",
"options": "Contact",
"fieldname": "contact",
"fieldtype": "Link",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Link",
@ -166,36 +182,6 @@
"permlevel": 2,
"in_filter": 1
},
{
"doctype": "DocField",
"label": "Address",
"fieldname": "address_display",
"fieldtype": "Small Text",
"permlevel": 2
},
{
"doctype": "DocField",
"label": "Contact Name",
"fieldname": "contact_display",
"fieldtype": "Data",
"permlevel": 2
},
{
"doctype": "DocField",
"label": "Mobile No",
"fieldname": "contact_mobile",
"fieldtype": "Data",
"permlevel": 2
},
{
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "Contact Email",
"oldfieldname": "contact_no",
"fieldname": "contact_email",
"fieldtype": "Data",
"permlevel": 2
},
{
"default": "Today",
"oldfieldtype": "Date",
@ -225,20 +211,6 @@
"depends_on": "eval:!doc.__islocal",
"permlevel": 1
},
{
"depends_on": "eval:!doc.__islocal",
"search_index": 1,
"colour": "White:FFF",
"doctype": "DocField",
"label": "Allocated To",
"oldfieldname": "allocated_to",
"permlevel": 1,
"fieldname": "allocated_to",
"fieldtype": "Link",
"oldfieldtype": "Link",
"options": "Profile",
"in_filter": 1
},
{
"no_copy": 1,
"oldfieldtype": "Text",
@ -246,7 +218,7 @@
"label": "Resolution Details",
"oldfieldname": "resolution_details",
"fieldname": "resolution_details",
"fieldtype": "Text",
"fieldtype": "Small Text",
"depends_on": "eval:!doc.__islocal",
"permlevel": 1
},