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

This commit is contained in:
Rushabh Mehta 2012-11-28 08:16:21 +01:00
commit 9ddad9c6e7
2 changed files with 33 additions and 9 deletions

View File

@ -20,6 +20,10 @@ erpnext.CommunicationView = Class.extend({
this.comm_list = []; this.comm_list = [];
$.extend(this, opts); $.extend(this, opts);
if(this.doc.__islocal) {
return;
}
this.list.sort(function(a, b) { return this.list.sort(function(a, b) { return
(new Date(a.modified) > new Date(b.modified)) (new Date(a.modified) > new Date(b.modified))
? -1 : 1; }) ? -1 : 1; })
@ -69,14 +73,15 @@ erpnext.CommunicationView = Class.extend({
{label:"Subject", fieldtype:"Data", reqd: 1}, {label:"Subject", fieldtype:"Data", reqd: 1},
{label:"Message", fieldtype:"Text Editor", reqd: 1, fieldname:"content"}, {label:"Message", fieldtype:"Text Editor", reqd: 1, fieldname:"content"},
{label:"Send Email", fieldtype:"Check"}, {label:"Send Email", fieldtype:"Check"},
{label:"Send", fieldtype:"Button"}, {label:"Add Reply", fieldtype:"Button"},
] ]
}); });
$(d.fields_dict.send_email.input).attr("checked", "checked") $(d.fields_dict.send_email.input).attr("checked", "checked")
$(d.fields_dict.send.input).click(function() { $(d.fields_dict.add_reply.input).click(function() {
var args = d.get_values(); var args = d.get_values();
if(!args) return; if(!args) return;
$(this).set_working();
wn.call({ wn.call({
method:"support.doctype.communication.communication.make", method:"support.doctype.communication.communication.make",
args: $.extend(args, { args: $.extend(args, {
@ -93,8 +98,15 @@ erpnext.CommunicationView = Class.extend({
}); });
}); });
d.fields_dict.content.input.set_input("<p></p><p></p>=== In response to ===<p></p>" if(me.list.length > 0) {
d.fields_dict.content.input.set_input("<p></p>"
+ (wn.boot.profile.email_signature || "")
+"<p></p>"
+"-----In response to-----<p></p>"
+ me.list[0].content) + me.list[0].content)
} else {
}
$(d.fields_dict.subject.input).val(this.doc.subject || "").change(); $(d.fields_dict.subject.input).val(this.doc.subject || "").change();
d.show(); d.show();
@ -108,7 +120,7 @@ erpnext.CommunicationView = Class.extend({
} }
if(!doc.sender) doc.sender = "[unknown sender]"; if(!doc.sender) doc.sender = "[unknown sender]";
doc.sender = doc.sender.replace(/</, "&lt;").replace(/>/, "&gt;"); doc.sender = doc.sender.replace(/</, "&lt;").replace(/>/, "&gt;");
doc.content = doc.content.split("=== In response to ===")[0]; doc.content = doc.content.split("-----In response to-----")[0];
doc.content = doc.content.split("-----Original Message-----")[0]; doc.content = doc.content.split("-----Original Message-----")[0];
}, },
make_line: function(doc) { make_line: function(doc) {
@ -117,8 +129,8 @@ erpnext.CommunicationView = Class.extend({
<p><b>%(sender)s on %(when)s</b> \ <p><b>%(sender)s on %(when)s</b> \
<a href="#Form/Communication/%(name)s" style="font-size: 90%">\ <a href="#Form/Communication/%(name)s" style="font-size: 90%">\
Show Details</a></p>\ Show Details</a></p>\
<div class="comm-content" style="border-top: 1px solid #ddd; padding: 10px; \ <div class="comm-content" style="border-top: 1px solid #ddd; \
display: none;"></div>\ padding: 10px; overflow-x: auto; display: none;"></div>\
</td></tr>', doc)) </td></tr>', doc))
.appendTo(this.body) .appendTo(this.body)
.css({"cursor":"pointer"}) .css({"cursor":"pointer"})

View File

@ -4,7 +4,7 @@
"docstatus": 0, "docstatus": 0,
"creation": "2012-11-02 17:17:05", "creation": "2012-11-02 17:17:05",
"modified_by": "Administrator", "modified_by": "Administrator",
"modified": "2012-11-27 18:21:06" "modified": "2012-11-28 10:45:19"
}, },
{ {
"autoname": "naming_series:", "autoname": "naming_series:",
@ -69,11 +69,17 @@
"doctype": "DocField", "doctype": "DocField",
"label": "Subject", "label": "Subject",
"fieldname": "subject", "fieldname": "subject",
"fieldtype": "Text", "fieldtype": "Data",
"reqd": 1, "reqd": 1,
"permlevel": 0, "permlevel": 0,
"in_filter": 1 "in_filter": 1
}, },
{
"doctype": "DocField",
"fieldname": "cb00",
"fieldtype": "Column Break",
"permlevel": 0
},
{ {
"oldfieldtype": "Data", "oldfieldtype": "Data",
"doctype": "DocField", "doctype": "DocField",
@ -86,6 +92,12 @@
"permlevel": 0, "permlevel": 0,
"in_filter": 1 "in_filter": 1
}, },
{
"doctype": "DocField",
"fieldname": "sb00",
"fieldtype": "Section Break",
"permlevel": 0
},
{ {
"oldfieldtype": "Text", "oldfieldtype": "Text",
"doctype": "DocField", "doctype": "DocField",