diff --git a/setup/doctype/email_digest/email_digest.py b/setup/doctype/email_digest/email_digest.py index 017001d44b..08e1dfe543 100644 --- a/setup/doctype/email_digest/email_digest.py +++ b/setup/doctype/email_digest/email_digest.py @@ -26,7 +26,7 @@ content_sequence = ["income_year_to_date", "bank_balance", "new_leads", "new_enquiries", "new_quotations", "new_sales_orders", "new_delivery_notes", "new_purchase_requests", "new_supplier_quotations", "new_purchase_orders", "new_purchase_receipts", "new_stock_entries", - "new_support_tickets", "new_communications", "new_projects"] + "new_support_tickets", "new_communications", "new_projects", "open_tickets"] class DocType: def __init__(self, doc, doclist=[]): @@ -71,7 +71,7 @@ class DocType: out = [] for ctype in content_sequence: if self.doc.fields.get(ctype) and hasattr(self, "get_"+ctype): - # appends [value, html] + # appends [not "no updates", html] out.append(getattr(self, "get_"+ctype)()) return self.get_msg_html(out) @@ -333,7 +333,19 @@ class DocType: self.doc.next_send = formatdate(next_send_date) + " at midnight" return send_date - + + def get_open_tickets(self): + open_tickets = webnotes.conn.sql("""select name, subject, modified, raised_by + from `tabSupport Ticket` where status='Open' + order by modified desc limit 10""", as_dict=True) + + if open_tickets: + return 1, """

Latest Open Tickets (max 10):

%s""" % \ + "".join(["

%(name)s: %(subject)s
by %(raised_by)s on %(modified)s

" % \ + t for t in open_tickets]) + else: + return 0, "" + def onload(self): self.get_next_sending() diff --git a/setup/doctype/email_digest/email_digest.txt b/setup/doctype/email_digest/email_digest.txt index 9de8c2842f..7d3e157521 100644 --- a/setup/doctype/email_digest/email_digest.txt +++ b/setup/doctype/email_digest/email_digest.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - u'creation': '2012-07-12 23:29:44', + u'creation': '2012-09-18 10:50:53', u'docstatus': 0, - u'modified': '2012-09-15 19:34:37', + u'modified': '2012-11-12 16:13:36', u'modified_by': u'Administrator', u'owner': u'Administrator' }, @@ -268,6 +268,15 @@ 'permlevel': 0 }, + # DocField + { + u'doctype': u'DocField', + 'fieldname': u'open_tickets', + 'fieldtype': u'Check', + 'label': u'Open Tickets', + 'permlevel': 0 + }, + # DocField { u'doctype': u'DocField', diff --git a/support/doctype/support_ticket/support_ticket.js b/support/doctype/support_ticket/support_ticket.js index c9c9ea1e52..c08203136a 100644 --- a/support/doctype/support_ticket/support_ticket.js +++ b/support/doctype/support_ticket/support_ticket.js @@ -119,31 +119,23 @@ $.extend(cur_frm.cscript, { }, 'Close Ticket': function() { - var doc = cur_frm.doc - - var answer = confirm("Close Ticket "+doc.name+"?\n\nAllocated To: "+doc.allocated_to+"\n\nSubject: "+doc.subject+""); - if(answer) { - if(doc.name) - $c_obj(make_doclist(doc.doctype, doc.name),'close_ticket','',function(r,rt) { - if(!r.exc) { - cur_frm.refresh(); - } - }); - } + var doc = cur_frm.doc + if(doc.name) + $c_obj(make_doclist(doc.doctype, doc.name),'close_ticket','',function(r,rt) { + if(!r.exc) { + cur_frm.refresh(); + } + }); }, 'Re-Open Ticket': function() { - var doc = cur_frm.doc - - var answer = confirm("Re-Open Ticket "+doc.name+"?\n\nAllocated To: "+doc.allocated_to+"\n\nSubject: "+doc.subject+""); - if(answer) { - if(doc.name) - $c_obj(make_doclist(doc.doctype, doc.name),'reopen_ticket','',function(r,rt) { - if(!r.exc) { - cur_frm.refresh(); - } - }); - } + var doc = cur_frm.doc + if(doc.name) + $c_obj(make_doclist(doc.doctype, doc.name),'reopen_ticket','',function(r,rt) { + if(!r.exc) { + cur_frm.refresh(); + } + }); }