moving support ticket response to communication (wip)

This commit is contained in:
Rushabh Mehta 2012-11-24 14:45:31 +05:30
parent 7d665818b5
commit 17db39dc94
4 changed files with 26 additions and 15 deletions

View File

@ -86,8 +86,8 @@ $.extend(cur_frm.cscript, {
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) {

View File

@ -64,8 +64,8 @@ class DocType(TransactionBase):
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 @@ class DocType(TransactionBase):
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):

View File

@ -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>

View File

@ -241,9 +241,19 @@ Calendar.prototype.set_event = function(ev) {
//------------------------------------------------------
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 @@ Calendar.prototype.refresh = function(viewtype){//Sets the viewtype of the Calen
this.cur_view.show();
}
else{
this.cur_view.get_events();
this.cur_view.refresh(this);
}
}