From 8a4f40cc239c8f86a32415b86b7eff02db23e5db Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 24 Aug 2012 14:46:04 +0530 Subject: [PATCH] fixes in unsubscribe --- js/legacy/widgets/form/form.js | 2 +- py/webnotes/utils/email_lib/bulk.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/js/legacy/widgets/form/form.js b/js/legacy/widgets/form/form.js index f9c23d1030..3922ad1ebe 100644 --- a/js/legacy/widgets/form/form.js +++ b/js/legacy/widgets/form/form.js @@ -588,7 +588,7 @@ _f.Frm.prototype.refresh = function(docname) { this.refresh_header(); this.sidebar && this.sidebar.refresh(); } - + // call trigger this.runclientscript('refresh'); diff --git a/py/webnotes/utils/email_lib/bulk.py b/py/webnotes/utils/email_lib/bulk.py index 29f2f43179..d04997f571 100644 --- a/py/webnotes/utils/email_lib/bulk.py +++ b/py/webnotes/utils/email_lib/bulk.py @@ -52,7 +52,7 @@ def send(recipients=[], doctype='Profile', email_field='email', first_name_field from webnotes.utils import get_request_site_address return message + """
- + Unsubscribe from this list.
""" % (get_request_site_address(), 'webnotes.utils.email_lib.bulk.unsubscribe', email, doctype, email_field) @@ -95,8 +95,8 @@ def unsubscribe(): doctype = webnotes.form_dict.get('type') field = webnotes.form_dict.get('email_field') email = webnotes.form_dict.get('email') - webnotes.conn.sql("""update `tab%s` set unsubscribed=1 - where email_id=%s""" % (doctype, '%s'), email) + webnotes.conn.sql("""update `tab%s` set unsubscribed=1 + where `%s`=%s""" % (doctype, field, '%s'), email) webnotes.unsubscribed_email = email webnotes.response['type'] = 'page' @@ -105,7 +105,7 @@ def unsubscribe(): def flush(): """flush email queue, every time: called from scheduler""" import webnotes - from webnotes.utils.email_lib.smtp import SMTPServer + from webnotes.utils.email_lib.smtp import SMTPServer, get_email smptserver = SMTPServer() @@ -119,7 +119,7 @@ def flush(): email["name"], auto_commit=True) except Exception, e: webnotes.conn.sql("""update `tabBulk Email` set status='Error', error=%s - where name=%s""", (str(e), email["name"]), auto_commit=True) + where name=%s""", (unicode(e), email["name"]), auto_commit=True) def clear_outbox(): """remove mails older than 30 days in Outbox"""