msgprint fix, company abbreviation length validation

This commit is contained in:
Anand Doshi 2012-09-19 12:41:06 +05:30
parent 39ca69e978
commit 8bdfaa3438
4 changed files with 6 additions and 6 deletions

View File

@ -83,7 +83,7 @@ class DocType:
# Account name must be unique
def validate_duplicate_account(self):
if (self.doc.__islocal or (not self.doc.name)) and sql("select name from tabAccount where account_name=%s and company=%s", (self.doc.account_name, self.doc.company)):
if (self.doc.fields.get('__islocal') or (not self.doc.name)) and sql("select name from tabAccount where account_name=%s and company=%s", (self.doc.account_name, self.doc.company)):
msgprint("Account Name already exists, please rename", raise_exception=1)
# validate root details

View File

@ -39,7 +39,7 @@ class DocType:
self.doc, self.doclist = d,dl
def validate(self):
if self.doc.__islocal and len(self.doc.abbr) > 5:
if self.doc.fields.get('__islocal') and len(self.doc.abbr) > 5:
webnotes.msgprint("Abbreviation cannot have more than 5 characters",
raise_exception=1)

View File

@ -603,14 +603,14 @@ document.body.appendChild(temp);temp.submit();return temp;}
/*
* lib/js/legacy/utils/msgprint.js
*/
var msg_dialog;function msgprint(msg,title){if(!msg)return;if(msg instanceof Array){$.each(msg,function(i,v){if(v)msgprint(v);})
var msg_dialog;function msgprint(msg,title){if(!msg)return;if(msg instanceof Array){$.each(msg,function(i,v){if(v){msgprint(v);}})
return;}
if(typeof(msg)!='string')
msg=JSON.stringify(msg);if(msg.substr(0,8)=='__small:'){show_alert(msg.substr(8));return;}
if(!msg_dialog){msg_dialog=new wn.ui.Dialog({title:"Message",onhide:function(){msg_dialog.msg_area.empty();}});msg_dialog.msg_area=$('<div class="msgprint">').appendTo(msg_dialog.body);}
if(msg.search(/<br>|<p>|<li>/)==-1)
msg=replace_newlines(msg);msg_dialog.set_title(title||'Message')
msg_dialog.msg_area.append(msg);msg_dialog.show();return msg_dialog;}
if(msg_dialog.msg_area.html())msg_dialog.msg_area.append("<hr>");msg_dialog.msg_area.append(msg);msg_dialog.show();return msg_dialog;}
var growl_area;function show_alert(txt,id){if(!growl_area){if(!$('#dialog-container').length){$('<div id="dialog-container">').appendTo('body');}
growl_area=$a($i('dialog-container'),'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});}
var wrapper=$a(growl_area,'div','',{position:'relative'});var body=$a(wrapper,'div','notice');var c=$a(body,'i','icon-remove-sign',{cssFloat:'right',cursor:'pointer'});$(c).click(function(){$dh(this.wrapper)});c.wrapper=wrapper;var t=$a(body,'div','',{color:'#FFF'});$(t).html(txt);if(id){$(t).attr('id',id);}

View File

@ -490,14 +490,14 @@ document.body.appendChild(temp);temp.submit();return temp;}
/*
* lib/js/legacy/utils/msgprint.js
*/
var msg_dialog;function msgprint(msg,title){if(!msg)return;if(msg instanceof Array){$.each(msg,function(i,v){if(v)msgprint(v);})
var msg_dialog;function msgprint(msg,title){if(!msg)return;if(msg instanceof Array){$.each(msg,function(i,v){if(v){msgprint(v);}})
return;}
if(typeof(msg)!='string')
msg=JSON.stringify(msg);if(msg.substr(0,8)=='__small:'){show_alert(msg.substr(8));return;}
if(!msg_dialog){msg_dialog=new wn.ui.Dialog({title:"Message",onhide:function(){msg_dialog.msg_area.empty();}});msg_dialog.msg_area=$('<div class="msgprint">').appendTo(msg_dialog.body);}
if(msg.search(/<br>|<p>|<li>/)==-1)
msg=replace_newlines(msg);msg_dialog.set_title(title||'Message')
msg_dialog.msg_area.append(msg);msg_dialog.show();return msg_dialog;}
if(msg_dialog.msg_area.html())msg_dialog.msg_area.append("<hr>");msg_dialog.msg_area.append(msg);msg_dialog.show();return msg_dialog;}
var growl_area;function show_alert(txt,id){if(!growl_area){if(!$('#dialog-container').length){$('<div id="dialog-container">').appendTo('body');}
growl_area=$a($i('dialog-container'),'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});}
var wrapper=$a(growl_area,'div','',{position:'relative'});var body=$a(wrapper,'div','notice');var c=$a(body,'i','icon-remove-sign',{cssFloat:'right',cursor:'pointer'});$(c).click(function(){$dh(this.wrapper)});c.wrapper=wrapper;var t=$a(body,'div','',{color:'#FFF'});$(t).html(txt);if(id){$(t).attr('id',id);}