fix in todos and email settings

This commit is contained in:
Anand Doshi 2012-06-14 16:46:48 +05:30
parent a86d7887f0
commit 616c355d20
3 changed files with 38 additions and 25 deletions

View File

@ -45,28 +45,33 @@ class DocType:
out_email.port = cint(self.doc.mail_port) out_email.port = cint(self.doc.mail_port)
out_email.use_ssl = self.doc.use_ssl out_email.use_ssl = self.doc.use_ssl
try: try:
err_msg = "Login Id or Mail Password missing. Please enter and try again."
if not (self.doc.mail_login and self.doc.mail_password):
raise AttributeError, err_msg
out_email.login = self.doc.mail_login.encode('utf-8') out_email.login = self.doc.mail_login.encode('utf-8')
out_email.password = self.doc.mail_password.encode('utf-8') out_email.password = self.doc.mail_password.encode('utf-8')
except AttributeError, e: except AttributeError, e:
webnotes.msgprint('Login Id or Mail Password missing. Please enter and try again.') webnotes.msgprint(err_msg)
webnotes.msgprint(e) raise e
try: try:
sess = out_email.smtp_connect() sess = out_email.smtp_connect()
try: try:
sess.quit() sess.quit()
except: except:
pass pass
except _socket.error, e: except _socket.error, e:
# Invalid mail server -- due to refusing connection # Invalid mail server -- due to refusing connection
webnotes.msgprint('Invalid Outgoing Mail Server. Please rectify and try again.') webnotes.msgprint('Invalid Outgoing Mail Server or Port. Please rectify and try again.')
webnotes.msgprint(e) raise e
except smtplib.SMTPAuthenticationError, e: except smtplib.SMTPAuthenticationError, e:
webnotes.msgprint('Invalid Login Id or Mail Password. Please rectify and try again.') webnotes.msgprint('Invalid Login Id or Mail Password. Please rectify and try again.')
raise e
except smtplib.SMTPException, e: except smtplib.SMTPException, e:
webnotes.msgprint('There is something wrong with your Outgoing Mail Settings. \ webnotes.msgprint('There is something wrong with your Outgoing Mail Settings. \
Please contact us at support@erpnext.com') Please contact us at support@erpnext.com')
webnotes.msgprint(e) raise e
def validate_incoming(self): def validate_incoming(self):
@ -81,11 +86,14 @@ class DocType:
inc_email.host = self.doc.support_host.encode('utf-8') inc_email.host = self.doc.support_host.encode('utf-8')
inc_email.use_ssl = self.doc.support_use_ssl inc_email.use_ssl = self.doc.support_use_ssl
try: try:
err_msg = 'User Name or Support Password missing. Please enter and try again.'
if not (self.doc.support_username and self.doc.support_password):
raise AttributeError, err_msg
inc_email.username = self.doc.support_username.encode('utf-8') inc_email.username = self.doc.support_username.encode('utf-8')
inc_email.password = self.doc.support_password.encode('utf-8') inc_email.password = self.doc.support_password.encode('utf-8')
except AttributeError, e: except AttributeError, e:
webnotes.msgprint('User Name or Support Password missing. Please enter and try again.') webnotes.msgprint(err_msg)
webnotes.msgprint(e) raise e
pop_mb = POP3Mailbox(inc_email) pop_mb = POP3Mailbox(inc_email)
@ -94,7 +102,7 @@ class DocType:
except _socket.error, e: except _socket.error, e:
# Invalid mail server -- due to refusing connection # Invalid mail server -- due to refusing connection
webnotes.msgprint('Invalid POP3 Mail Server. Please rectify and try again.') webnotes.msgprint('Invalid POP3 Mail Server. Please rectify and try again.')
webnotes.msgprint(e) raise e
except poplib.error_proto, e: except poplib.error_proto, e:
webnotes.msgprint('Invalid User Name or Support Password. Please rectify and try again.') webnotes.msgprint('Invalid User Name or Support Password. Please rectify and try again.')
webnotes.msgprint(e) raise e

View File

@ -1,4 +1,6 @@
<div class="layout-wrapper" style="min-height: 300px; background-color: #FFFDC9"> <div class="layout-wrapper" style="min-height: 300px; background-color: #FFFDC9">
<div class="appframe-area"></div>
<div>
<a class="close" onclick="window.history.back();">&times;</a> <a class="close" onclick="window.history.back();">&times;</a>
<h1>To Do</h1> <h1>To Do</h1>
<br> <br>
@ -15,4 +17,5 @@
<div style="margin-top: 21px; clear: both"> <div style="margin-top: 21px; clear: both">
<button id="add-todo" class="btn btn-small"><i class="icon-plus"></i> Add</button> <button id="add-todo" class="btn btn-small"><i class="icon-plus"></i> Add</button>
</div> </div>
</div>
</div> </div>

View File

@ -67,16 +67,18 @@ erpnext.todo.ToDoItem = Class.extend({
todo.fullname = ''; todo.fullname = '';
if(todo.assigned_by) { if(todo.assigned_by) {
var assigned_by = wn.boot.user_info[todo.assigned_by]
todo.fullname = repl("[By %(fullname)s] &nbsp;", { todo.fullname = repl("[By %(fullname)s] &nbsp;", {
fullname: wn.boot.user_info[todo.assigned_by].fullname fullname: (assigned_by ? assigned_by.fullname : todo.assigned_by),
}); });
} }
var parent_list = "#todo-list"; var parent_list = "#todo-list";
if(todo.owner !== user) { if(todo.owner !== user) {
parent_list = "#assigned-todo-list"; parent_list = "#assigned-todo-list";
var owner = wn.boot.user_info[todo.owner];
todo.fullname = repl("[To %(fullname)s] &nbsp;", { todo.fullname = repl("[To %(fullname)s] &nbsp;", {
fullname: wn.boot.user_info[todo.owner].fullname fullname: (owner ? owner.fullname : todo.owner),
}); });
} }
parent_list += " div.todo-content"; parent_list += " div.todo-content";