[communication] [minor]

This commit is contained in:
Rushabh Mehta
2013-09-02 18:27:29 +05:30
parent 1f16630360
commit a2d0da8840
4 changed files with 93 additions and 9 deletions

View File

@@ -46,16 +46,12 @@ $.extend(cur_frm.cscript, {
make_listing: function(doc) {
var wrapper = cur_frm.fields_dict['thread_html'].wrapper;
var comm_list = wn.model.get("Communication", {"support_ticket": doc.name})
var sortfn = function (a, b) { return (b.creation > a.creation) ? 1 : -1; }
comm_list = comm_list.sort(sortfn);
var comm_list = wn.model.get("Communication", {"parent": doc.name, "parenttype":"Support Ticket"})
if(!comm_list.length || (comm_list[comm_list.length - 1].sender != doc.raised_by)) {
if(!comm_list.length) {
comm_list.push({
"sender": doc.raised_by,
"creation": doc.creation,
"modified": doc.creation,
"communication_date": doc.creation,
"content": doc.description});
}