From 92fd9cce356347f7f9a98a9245c89ab85e42c2a0 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 14 Jun 2012 14:55:44 +0530 Subject: [PATCH 1/5] fixes in support ticket and email settings --- .../june_2012/support_ticket_autoreply.py | 15 +++++++++++++++ erpnext/patches/patch_list.py | 5 +++++ .../doctype/email_settings/email_settings.txt | 18 ++++++++++++++---- .../support/doctype/support_ticket/__init__.py | 3 ++- 4 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 erpnext/patches/june_2012/support_ticket_autoreply.py diff --git a/erpnext/patches/june_2012/support_ticket_autoreply.py b/erpnext/patches/june_2012/support_ticket_autoreply.py new file mode 100644 index 0000000000..cdb47a21c2 --- /dev/null +++ b/erpnext/patches/june_2012/support_ticket_autoreply.py @@ -0,0 +1,15 @@ +def execute(): + """New Send Autoreply checkbox in Email Settings""" + import webnotes + import webnotes.utils + + import webnotes.model.sync + webnotes.conn.commit() + webnotes.model.sync.sync('setup', 'email_settings') + webnotes.conn.begin() + + sync_support_mails = webnotes.utils.cint(webnotes.conn.get_value('Email Settings', + None, 'sync_support_mails')) + + if sync_support_mails: + webnotes.conn.set_value('Email Settings', None, 'send_autoreply', 1) \ No newline at end of file diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index b4717803a4..87c96c135a 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -432,4 +432,9 @@ patch_list = [ 'patch_file': 'reports_list_permission', 'description': 'allow read permission to all for report list' }, + { + 'patch_module': 'patches.june_2012', + 'patch_file': 'support_ticket_autoreply', + 'description': 'New Send Autoreply checkbox in Email Settings' + }, ] \ No newline at end of file diff --git a/erpnext/setup/doctype/email_settings/email_settings.txt b/erpnext/setup/doctype/email_settings/email_settings.txt index fdf1cf097b..2772367263 100644 --- a/erpnext/setup/doctype/email_settings/email_settings.txt +++ b/erpnext/setup/doctype/email_settings/email_settings.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:20', + 'creation': '2012-05-15 12:15:01', 'docstatus': 0, - 'modified': '2012-03-27 14:36:20', + 'modified': '2012-06-14 14:47:49', 'modified_by': u'Administrator', 'owner': u'harshada@webnotestech.com' }, @@ -25,7 +25,7 @@ 'name': '__common__', 'section_style': u'Simple', 'server_code_error': u' ', - 'version': 35 + 'version': 1 }, # These values are common for all DocField @@ -230,6 +230,16 @@ 'label': u'Signature' }, + # DocField + { + 'colour': u'White:FFF', + 'default': u'1', + 'doctype': u'DocField', + 'fieldname': u'send_autoreply', + 'fieldtype': u'Check', + 'label': u'Send Autoreply' + }, + # DocField { 'colour': u'White:FFF', @@ -237,6 +247,6 @@ 'doctype': u'DocField', 'fieldname': u'support_autoreply', 'fieldtype': u'Text', - 'label': u'Autoreply' + 'label': u'Custom Autoreply Message' } ] \ No newline at end of file diff --git a/erpnext/support/doctype/support_ticket/__init__.py b/erpnext/support/doctype/support_ticket/__init__.py index d2dbe60f2c..7335dad90e 100644 --- a/erpnext/support/doctype/support_ticket/__init__.py +++ b/erpnext/support/doctype/support_ticket/__init__.py @@ -177,5 +177,6 @@ def get_support_mails(): Gets new emails from support inbox and updates / creates Support Ticket records """ import webnotes - if webnotes.conn.get_value('Email Settings', None, 'sync_support_mails'): + from webnotes.utils import cint + if cint(webnotes.conn.get_value('Email Settings', None, 'sync_support_mails')): SupportMailbox().get_messages() \ No newline at end of file From a86d7887f09e762a00ba47871f459b9e5f7f252d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 14 Jun 2012 14:59:04 +0530 Subject: [PATCH 2/5] fixes in support ticket autoreply --- erpnext/support/doctype/support_ticket/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/support/doctype/support_ticket/__init__.py b/erpnext/support/doctype/support_ticket/__init__.py index 7335dad90e..de596f95f9 100644 --- a/erpnext/support/doctype/support_ticket/__init__.py +++ b/erpnext/support/doctype/support_ticket/__init__.py @@ -15,7 +15,7 @@ # along with this program. If not, see . import webnotes -from webnotes.utils import cstr +from webnotes.utils import cstr, cint from webnotes.utils.email_lib.receive import POP3Mailbox @@ -113,7 +113,8 @@ class SupportMailbox(POP3Mailbox): update_feed(d, 'on_update') # send auto reply - self.send_auto_reply(d) + if cint(self.email_settings.send_autoreply): + self.send_auto_reply(d) webnotes.conn.commit() From 616c355d209df98d69eed780ea77941d83dbee2b Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 14 Jun 2012 16:46:48 +0530 Subject: [PATCH 3/5] fix in todos and email settings --- .../doctype/email_settings/email_settings.py | 26 +++++++++++------ erpnext/utilities/page/todo/todo.html | 29 ++++++++++--------- erpnext/utilities/page/todo/todo.js | 8 +++-- 3 files changed, 38 insertions(+), 25 deletions(-) diff --git a/erpnext/setup/doctype/email_settings/email_settings.py b/erpnext/setup/doctype/email_settings/email_settings.py index 3e17636b39..755b91d20a 100644 --- a/erpnext/setup/doctype/email_settings/email_settings.py +++ b/erpnext/setup/doctype/email_settings/email_settings.py @@ -45,28 +45,33 @@ class DocType: out_email.port = cint(self.doc.mail_port) out_email.use_ssl = self.doc.use_ssl 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.password = self.doc.mail_password.encode('utf-8') except AttributeError, e: - webnotes.msgprint('Login Id or Mail Password missing. Please enter and try again.') - webnotes.msgprint(e) + webnotes.msgprint(err_msg) + raise e try: sess = out_email.smtp_connect() + try: sess.quit() except: pass except _socket.error, e: # Invalid mail server -- due to refusing connection - webnotes.msgprint('Invalid Outgoing Mail Server. Please rectify and try again.') - webnotes.msgprint(e) + webnotes.msgprint('Invalid Outgoing Mail Server or Port. Please rectify and try again.') + raise e except smtplib.SMTPAuthenticationError, e: webnotes.msgprint('Invalid Login Id or Mail Password. Please rectify and try again.') + raise e except smtplib.SMTPException, e: webnotes.msgprint('There is something wrong with your Outgoing Mail Settings. \ Please contact us at support@erpnext.com') - webnotes.msgprint(e) + raise e def validate_incoming(self): @@ -81,11 +86,14 @@ class DocType: inc_email.host = self.doc.support_host.encode('utf-8') inc_email.use_ssl = self.doc.support_use_ssl 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.password = self.doc.support_password.encode('utf-8') except AttributeError, e: - webnotes.msgprint('User Name or Support Password missing. Please enter and try again.') - webnotes.msgprint(e) + webnotes.msgprint(err_msg) + raise e pop_mb = POP3Mailbox(inc_email) @@ -94,7 +102,7 @@ class DocType: except _socket.error, e: # Invalid mail server -- due to refusing connection webnotes.msgprint('Invalid POP3 Mail Server. Please rectify and try again.') - webnotes.msgprint(e) + raise e except poplib.error_proto, e: webnotes.msgprint('Invalid User Name or Support Password. Please rectify and try again.') - webnotes.msgprint(e) + raise e diff --git a/erpnext/utilities/page/todo/todo.html b/erpnext/utilities/page/todo/todo.html index 8c50218b77..d49fc23011 100644 --- a/erpnext/utilities/page/todo/todo.html +++ b/erpnext/utilities/page/todo/todo.html @@ -1,18 +1,21 @@ -
- × -

To Do

-
+
+
-
-

My List


-
+ × +

To Do

+
+
+
+

My List


+
+
+
+

Assigned to others


+
+
-
-

Assigned to others


-
+
+
-
- -
\ No newline at end of file diff --git a/erpnext/utilities/page/todo/todo.js b/erpnext/utilities/page/todo/todo.js index 8cd8fc1e5f..206becf36d 100644 --- a/erpnext/utilities/page/todo/todo.js +++ b/erpnext/utilities/page/todo/todo.js @@ -67,16 +67,18 @@ erpnext.todo.ToDoItem = Class.extend({ todo.fullname = ''; if(todo.assigned_by) { + var assigned_by = wn.boot.user_info[todo.assigned_by] todo.fullname = repl("[By %(fullname)s]  ", { - fullname: wn.boot.user_info[todo.assigned_by].fullname + fullname: (assigned_by ? assigned_by.fullname : todo.assigned_by), }); } var parent_list = "#todo-list"; if(todo.owner !== user) { parent_list = "#assigned-todo-list"; + var owner = wn.boot.user_info[todo.owner]; todo.fullname = repl("[To %(fullname)s]  ", { - fullname: wn.boot.user_info[todo.owner].fullname + fullname: (owner ? owner.fullname : todo.owner), }); } parent_list += " div.todo-content"; @@ -197,4 +199,4 @@ erpnext.todo.save = function(btn) { wn.pages.todo.onload = function() { // load todos erpnext.todo.refresh(); -} +} \ No newline at end of file From 7d1e8f218b3b674551cbb1722057efb820c8be05 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 14 Jun 2012 18:11:36 +0530 Subject: [PATCH 4/5] change date field for sales invoice in sales personwise transaction summary search criteria --- .../sales_personwise_transaction_summary.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.js b/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.js index 48791833ae..335df7a6d7 100755 --- a/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.js +++ b/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.js @@ -41,7 +41,7 @@ report.get_query = function() { date_fld = 'transaction_date'; if(based_on == 'Sales Invoice') { based_on = 'Sales Invoice'; - date_fld = 'voucher_date'; + date_fld = 'posting_date'; } sp_cond = ''; From 3878b2a1ac45c2956a3e1627594809fa76ad02c2 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 14 Jun 2012 18:28:29 +0530 Subject: [PATCH 5/5] add unique constraint to tabSeries name column --- erpnext/patches/june_2012/series_unique_patch.py | 6 ++++++ erpnext/patches/patch_list.py | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 erpnext/patches/june_2012/series_unique_patch.py diff --git a/erpnext/patches/june_2012/series_unique_patch.py b/erpnext/patches/june_2012/series_unique_patch.py new file mode 100644 index 0000000000..6f85f21df3 --- /dev/null +++ b/erpnext/patches/june_2012/series_unique_patch.py @@ -0,0 +1,6 @@ +def execute(): + """add unique constraint to series table's name column""" + import webnotes + webnotes.conn.commit() + webnotes.conn.sql("alter table `tabSeries` add unique (name)") + webnotes.conn.begin() \ No newline at end of file diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 87c96c135a..98c3aff772 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -437,4 +437,9 @@ patch_list = [ 'patch_file': 'support_ticket_autoreply', 'description': 'New Send Autoreply checkbox in Email Settings' }, + { + 'patch_module': 'patches.june_2012', + 'patch_file': 'series_unique_patch', + 'description': "add unique constraint to series table's name column" + }, ] \ No newline at end of file