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 +} 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): """