Merge branch 'master' of github.com:webnotes/erpnext
diff --git a/support/doctype/support_ticket/support_ticket.js b/support/doctype/support_ticket/support_ticket.js
index 7f3fc1d..8bf91b2 100644
--- a/support/doctype/support_ticket/support_ticket.js
+++ b/support/doctype/support_ticket/support_ticket.js
@@ -86,8 +86,8 @@
parent: $a(cur_frm.fields_dict['thread_html'].wrapper, 'div'),
no_result_message: 'No responses yet',
get_query: function() {
- return 'select mail, from_email, creation, content_type '+
- 'from `tabSupport Ticket Response` where parent="'+doc.name+'" order by creation asc'
+ return 'select content, email_address, creation '+
+ 'from `tabCommunication` where support_ticket="'+doc.name+'" order by creation asc'
},
as_dict: 1,
render_row: function(parent, data, list, idx) {
diff --git a/support/doctype/support_ticket/support_ticket.py b/support/doctype/support_ticket/support_ticket.py
index 3968618..84bdfd2 100644
--- a/support/doctype/support_ticket/support_ticket.py
+++ b/support/doctype/support_ticket/support_ticket.py
@@ -64,8 +64,8 @@
def last_response(self):
"""return last response"""
- tmp = webnotes.conn.sql("""select mail from `tabSupport Ticket Response`
- where parent = %s order by creation desc limit 1
+ tmp = webnotes.conn.sql("""select mail from `tabCommunication`
+ where support_ticket = %s order by creation desc limit 1
""", self.doc.name)
if not tmp:
@@ -84,17 +84,17 @@
def make_response_record(self, response, from_email = None, content_type='text/plain'):
"""
- Creates a new Support Ticket Response record
+ Creates a new Communication record
"""
- # add to Support Ticket Response
+ # add to Communication
from webnotes.model.doc import Document
- d = Document('Support Ticket Response')
- d.from_email = from_email or webnotes.user.name
- d.parent = self.doc.name
- d.parenttype = "Support Ticket"
- d.parentfield = "responses"
- d.mail = response
- d.content_type = content_type
+ d = Document('Communication')
+ d.naming_series = "COMM-"
+ d.subject = self.doc.subject
+ d.email_address = from_email or webnotes.user.name
+ d.support_ticket = self.doc.name
+ d.content = response
+ d.communication_medium = "Email"
d.save(1)
def close_ticket(self):
diff --git a/utilities/page/calendar/calendar.html b/utilities/page/calendar/calendar.html
index 11dd3bf..0f8cc0e 100644
--- a/utilities/page/calendar/calendar.html
+++ b/utilities/page/calendar/calendar.html
@@ -13,7 +13,7 @@
<button class="btn btn-small" onclick="erpnext.calendar.refresh('Month')">
Month View
</button>
- <button class="btn btn-small" onclick="erpnext.calendar.refresh()">
+ <button class="btn btn-small" onclick="erpnext.calendar.refresh(null, true)">
<i class="icon-refresh"></i> Refresh
</button>
</div>
diff --git a/utilities/page/calendar/calendar.js b/utilities/page/calendar/calendar.js
index 0f4ff3b..e7abbab 100644
--- a/utilities/page/calendar/calendar.js
+++ b/utilities/page/calendar/calendar.js
@@ -241,9 +241,19 @@
//------------------------------------------------------
-Calendar.prototype.refresh = function(viewtype){//Sets the viewtype of the Calendar and Calls the View class based on the viewtype
+Calendar.prototype.clear = function() {
+ this.events = {};
+ this.events_by_name = {};
+ locals.Event = {};
+}
+
+Calendar.prototype.refresh = function(viewtype, clear_events){//Sets the viewtype of the Calendar and Calls the View class based on the viewtype
if(viewtype)
this.viewtype = viewtype;
+
+ if(clear_events)
+ this.clear();
+
// switch view if reqd
if(this.cur_view.viewtype!=this.viewtype) {
this.cur_view.hide();
@@ -252,6 +262,7 @@
this.cur_view.show();
}
else{
+ this.cur_view.get_events();
this.cur_view.refresh(this);
}
}