From 91e40c6d9b21afff1cf32abc6b9775f99937518a Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 4 Jan 2012 19:33:04 +0530 Subject: [PATCH 1/2] Added on submit callback event to provide a way for notifications --- js/legacy/form.compressed.js | 2 +- js/legacy/widgets/form/form.js | 9 ++++++++- js/legacy/widgets/form/form_header.js | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/js/legacy/form.compressed.js b/js/legacy/form.compressed.js index bac624e57d..10d6fba74b 100644 --- a/js/legacy/form.compressed.js +++ b/js/legacy/form.compressed.js @@ -182,7 +182,7 @@ if(me.doc.__islocal){$c('webnotes.widgets.form.getdoctype',{'doctype':me.doctype $c('webnotes.widgets.form.getdoc',{'name':me.docname,'doctype':me.doctype,'getdoctype':1,'user':user},ret_fn,null,null,'Refreshing '+me.docname+'...');}} _f.Frm.prototype.savedoc=function(save_action,onsave,onerr){this.error_in_section=0;save_doclist(this.doctype,this.docname,save_action,onsave,onerr);} _f.Frm.prototype.saveupdate=function(){this.save('Update');} -_f.Frm.prototype.savesubmit=function(){var answer=confirm("Permanently Submit "+this.docname+"?");if(answer)this.save('Submit');} +_f.Frm.prototype.savesubmit=function(){var answer=confirm("Permanently Submit "+this.docname+"?");var me=this;if(answer){this.save('Submit',function(){if(me.cscript.on_submit){me.runclientscript('on_submit',me.doctype,me.docname);}});}} _f.Frm.prototype.savecancel=function(){var answer=confirm("Permanently Cancel "+this.docname+"?");if(answer)this.save('Cancel');} _f.Frm.prototype.savetrash=function(){var me=this;var answer=confirm("Permanently Delete "+this.docname+"? This action cannot be reversed");if(answer){$c('webnotes.model.delete_doc',{dt:this.doctype,dn:this.docname},function(r,rt){if(r.message=='okay'){LocalDB.delete_doc(me.doctype,me.docname);if(page_body.wntoolbar)page_body.wntoolbar.rdocs.remove(me.doctype,me.docname);nav_obj.show_last_open();}})}} _f.Frm.prototype.amend_doc=function(){if(!this.fields_dict['amended_from']){alert('"amended_from" field must be present to do an amendment.');return;} diff --git a/js/legacy/widgets/form/form.js b/js/legacy/widgets/form/form.js index 25b9ecf8e7..c582428194 100644 --- a/js/legacy/widgets/form/form.js +++ b/js/legacy/widgets/form/form.js @@ -1117,7 +1117,14 @@ _f.Frm.prototype.saveupdate = function() { _f.Frm.prototype.savesubmit = function() { var answer = confirm("Permanently Submit "+this.docname+"?"); - if(answer) this.save('Submit'); + var me = this; + if(answer) { + this.save('Submit', function() { + if(me.cscript.on_submit) { + me.runclientscript('on_submit', me.doctype, me.docname); + } + }); + } } _f.Frm.prototype.savecancel = function() { diff --git a/js/legacy/widgets/form/form_header.js b/js/legacy/widgets/form/form_header.js index 423ec2ac27..5b59d7ae86 100644 --- a/js/legacy/widgets/form/form_header.js +++ b/js/legacy/widgets/form/form_header.js @@ -217,4 +217,4 @@ _f.FrmHeader.prototype.refresh_labels = function(f) { // timestamp this.timestamp_area.innerHTML = me.get_timestamp(doc); -} \ No newline at end of file +} From f2fb3a4abf9435cbd04ea89c5e6ca364c683507f Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 5 Jan 2012 13:52:56 +0530 Subject: [PATCH 2/2] Fix regarding support ticket to support ticket system email chaining issue --- py/webnotes/utils/email_lib/receive.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/py/webnotes/utils/email_lib/receive.py b/py/webnotes/utils/email_lib/receive.py index 2dc2735689..024ed0ec22 100644 --- a/py/webnotes/utils/email_lib/receive.py +++ b/py/webnotes/utils/email_lib/receive.py @@ -66,9 +66,11 @@ class IncomingMail: Extracts thread id of the message between first [] from the subject """ + import re subject = self.mail.get('Subject', '') - if '[' in subject and ']' in subject: - return subject.split('[')[1].split(']')[0] + + return re.findall('(?<=\[)\w+', subject) + def process_part(self, part): """