[communication] [minor]
This commit is contained in:
parent
1f16630360
commit
a2d0da8840
@ -16,7 +16,7 @@ cur_frm.cscript = {
|
|||||||
},
|
},
|
||||||
make_listing: function(doc) {
|
make_listing: function(doc) {
|
||||||
cur_frm.communication_view = new wn.views.CommunicationList({
|
cur_frm.communication_view = new wn.views.CommunicationList({
|
||||||
list: wn.model.get("Communication", {"job_applicant": doc.name}),
|
list: wn.model.get("Communication", {"parent": doc.name, "parenttype": "Job Applicant"}),
|
||||||
parent: cur_frm.fields_dict['thread_html'].wrapper,
|
parent: cur_frm.fields_dict['thread_html'].wrapper,
|
||||||
doc: doc,
|
doc: doc,
|
||||||
recipients: doc.email_id
|
recipients: doc.email_id
|
||||||
|
@ -7,4 +7,9 @@ def execute():
|
|||||||
set parenttype=%s, parentfield='communications',
|
set parenttype=%s, parentfield='communications',
|
||||||
parent=`%s`
|
parent=`%s`
|
||||||
where ifnull(`%s`, '')!=''""" % ("%s", fieldname, fieldname), doctype)
|
where ifnull(`%s`, '')!=''""" % ("%s", fieldname, fieldname), doctype)
|
||||||
|
|
||||||
|
webnotes.reload_doc("core", "doctype", "communication")
|
||||||
|
|
||||||
|
webnotes.conn.sql("""update tabCommunication set communication_date = creation where
|
||||||
|
ifnull(communication_date, '')='' """)
|
||||||
|
|
@ -36,7 +36,90 @@ erpnext.LeadController = wn.ui.form.Controller.extend({
|
|||||||
|
|
||||||
this.frm.dashboard.reset(doc);
|
this.frm.dashboard.reset(doc);
|
||||||
if(!doc.__islocal) {
|
if(!doc.__islocal) {
|
||||||
if(doc.status=="Converted") {
|
if(doc.status=="Converted") {// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||||
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
|
||||||
|
return{ query:"controllers.queries.customer_query" } }
|
||||||
|
|
||||||
|
wn.provide("erpnext.support");
|
||||||
|
// TODO commonify this code
|
||||||
|
erpnext.support.CustomerIssue = wn.ui.form.Controller.extend({
|
||||||
|
customer: function() {
|
||||||
|
var me = this;
|
||||||
|
if(this.frm.doc.customer) {
|
||||||
|
return this.frm.call({
|
||||||
|
doc: this.frm.doc,
|
||||||
|
method: "set_customer_defaults",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.extend(cur_frm.cscript, new erpnext.support.CustomerIssue({frm: cur_frm}));
|
||||||
|
|
||||||
|
$.extend(cur_frm.cscript, {
|
||||||
|
onload: function(doc, dt, dn) {
|
||||||
|
if(in_list(user_roles,'System Manager')) {
|
||||||
|
cur_frm.footer.help_area.innerHTML = '<p><a href="#Form/Email Settings/Email Settings">Email Settings</a><br>\
|
||||||
|
<span class="help">Integrate incoming support emails to Support Ticket</span></p>';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
refresh: function(doc) {
|
||||||
|
erpnext.hide_naming_series();
|
||||||
|
cur_frm.cscript.make_listing(doc);
|
||||||
|
if(!doc.__islocal) {
|
||||||
|
if(cur_frm.fields_dict.status.get_status()=="Write") {
|
||||||
|
if(doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cur_frm.cscript['Close Ticket']);
|
||||||
|
if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket', cur_frm.cscript['Re-Open Ticket']);
|
||||||
|
}
|
||||||
|
|
||||||
|
cur_frm.toggle_enable(["subject", "raised_by"], false);
|
||||||
|
cur_frm.toggle_display("description", false);
|
||||||
|
}
|
||||||
|
refresh_field('status');
|
||||||
|
},
|
||||||
|
|
||||||
|
make_listing: function(doc) {
|
||||||
|
var wrapper = cur_frm.fields_dict['thread_html'].wrapper;
|
||||||
|
|
||||||
|
var comm_list = wn.model.get("Communication", {"parent": doc.name, "parenttype":"Lead"})
|
||||||
|
|
||||||
|
cur_frm.communication_view = new wn.views.CommunicationList({
|
||||||
|
list: comm_list,
|
||||||
|
parent: wrapper,
|
||||||
|
doc: doc,
|
||||||
|
recipients: doc.raised_by
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
'Close Ticket': function() {
|
||||||
|
cur_frm.cscript.set_status("Closed");
|
||||||
|
},
|
||||||
|
|
||||||
|
'Re-Open Ticket': function() {
|
||||||
|
cur_frm.cscript.set_status("Open");
|
||||||
|
},
|
||||||
|
|
||||||
|
set_status: function(status) {
|
||||||
|
return wn.call({
|
||||||
|
method:"support.doctype.support_ticket.support_ticket.set_status",
|
||||||
|
args: {
|
||||||
|
name: cur_frm.doc.name,
|
||||||
|
status: status
|
||||||
|
},
|
||||||
|
callback: function(r) {
|
||||||
|
if(!r.exc) cur_frm.reload_doc();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
this.frm.dashboard.set_headline_alert(wn._("Converted"), "alert-success", "icon-ok-sign");
|
this.frm.dashboard.set_headline_alert(wn._("Converted"), "alert-success", "icon-ok-sign");
|
||||||
} else {
|
} else {
|
||||||
this.frm.dashboard.set_headline_alert(wn._(doc.status), "alert-info", "icon-exclamation-sign");
|
this.frm.dashboard.set_headline_alert(wn._(doc.status), "alert-info", "icon-exclamation-sign");
|
||||||
|
@ -46,16 +46,12 @@ $.extend(cur_frm.cscript, {
|
|||||||
make_listing: function(doc) {
|
make_listing: function(doc) {
|
||||||
var wrapper = cur_frm.fields_dict['thread_html'].wrapper;
|
var wrapper = cur_frm.fields_dict['thread_html'].wrapper;
|
||||||
|
|
||||||
var comm_list = wn.model.get("Communication", {"support_ticket": doc.name})
|
var comm_list = wn.model.get("Communication", {"parent": doc.name, "parenttype":"Support Ticket"})
|
||||||
|
|
||||||
var sortfn = function (a, b) { return (b.creation > a.creation) ? 1 : -1; }
|
|
||||||
comm_list = comm_list.sort(sortfn);
|
|
||||||
|
|
||||||
if(!comm_list.length || (comm_list[comm_list.length - 1].sender != doc.raised_by)) {
|
if(!comm_list.length) {
|
||||||
comm_list.push({
|
comm_list.push({
|
||||||
"sender": doc.raised_by,
|
"sender": doc.raised_by,
|
||||||
"creation": doc.creation,
|
"communication_date": doc.creation,
|
||||||
"modified": doc.creation,
|
|
||||||
"content": doc.description});
|
"content": doc.description});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user