From a4fe7180f4a58d2771b9bf7bee6af7fcbe2cf09c Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 2 Aug 2012 13:07:23 +0530 Subject: [PATCH 1/2] html generation moved from web.py to web_cache.py so it can be called from other places as a response from server.py --- erpnext/website/utils.py | 34 ++++++++++++++++++++++++++++++++++ erpnext/website/web_cache.py | 2 ++ public/web.py | 33 +-------------------------------- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/erpnext/website/utils.py b/erpnext/website/utils.py index 22fcce741f2..470dbd71923 100644 --- a/erpnext/website/utils.py +++ b/erpnext/website/utils.py @@ -41,3 +41,37 @@ def page_name(title): name = title.lower() name = re.sub('[~!@#$%^&*()<>,."\']', '', name) return '-'.join(name.split()[:4]) + +def render(page_name): + """render html page""" + import webnotes + try: + if page_name: + html = get_html(page_name) + else: + html = get_html('index') + except Exception, e: + html = get_html('404') + + print "Content-Type: text/html" + print + print html.encode('utf-8') + +def get_html(page_name): + """get page html""" + page_name = scrub_page_name(page_name) + comments = get_comments(page_name) + + import website.web_cache + html = website.web_cache.get_html(page_name, comments) + return html + +def get_comments(page_name): + import webnotes + + if page_name == '404': + comments = """error: %s""" % webnotes.getTraceback() + else: + comments = """page: %s""" % page_name + + return comments diff --git a/erpnext/website/web_cache.py b/erpnext/website/web_cache.py index 893f7f2d2a4..e08499baf1a 100644 --- a/erpnext/website/web_cache.py +++ b/erpnext/website/web_cache.py @@ -91,6 +91,7 @@ def get_predefined_pages(): return page_list def prepare_args(page_name): + import webnotes if page_name == 'index': page_name = get_home_page() @@ -98,6 +99,7 @@ def prepare_args(page_name): args = { 'template': 'pages/%s.html' % page_name, 'name': page_name, + 'webnotes': webnotes } else: args = get_doc_fields(page_name) diff --git a/public/web.py b/public/web.py index 34d38feca00..dcacfcd1069 100755 --- a/public/web.py +++ b/public/web.py @@ -40,39 +40,8 @@ def init(): def respond(): import webnotes - try: - if 'page' in webnotes.form_dict: - html = get_html(webnotes.form_dict['page']) - else: - # show home page - html = get_html('index') - except Exception, e: - html = get_html('404') - - print "Content-Type: text/html" - print - print html.encode('utf-8') - -def get_html(page_name): import website.utils - page_name = website.utils.scrub_page_name(page_name) - - comments = get_comments(page_name) - - import website.web_cache - html = website.web_cache.get_html(page_name, comments) - - return html - -def get_comments(page_name): - import webnotes - - if page_name == '404': - comments = """error: %s""" % webnotes.getTraceback() - else: - comments = """page: %s""" % page_name - - return comments + return website.utils.render(webnotes.form_dict.get('page')) if __name__=="__main__": init() From f0018b5e051b765a643f46491c17d924c799e417 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 2 Aug 2012 18:03:12 +0530 Subject: [PATCH 2/2] added unsubscribed fields in Lead and Contact and cleaned up sendmail function --- .../home/doctype/home_control/home_control.py | 16 --- .../project_control/project_control.py | 3 +- erpnext/projects/doctype/task/task.py | 5 +- erpnext/selling/doctype/lead/lead.js | 10 -- erpnext/selling/doctype/lead/lead.py | 56 -------- erpnext/selling/doctype/lead/lead.txt | 30 ++-- erpnext/selling/doctype/lead/lead_list.js | 3 +- .../doctype/opportunity/opportunity.py | 113 +-------------- .../doctype/email_digest/email_digest.py | 1 - .../doctype/email_settings/email_settings.py | 42 ++---- erpnext/startup/schedule_handlers.py | 39 ++--- erpnext/stock/doctype/item/item.py | 21 --- erpnext/utilities/doctype/contact/contact.txt | 134 ++---------------- .../doctype/blog_subscriber/__init__.py | 0 .../blog_subscriber/blog_subscriber.txt | 29 ---- erpnext/website/page/unsubscribe/__init__.py | 0 .../website/page/unsubscribe/unsubscribe.html | 13 -- .../website/page/unsubscribe/unsubscribe.js | 37 ----- .../website/page/unsubscribe/unsubscribe.py | 26 ---- .../website/page/unsubscribe/unsubscribe.txt | 43 ------ .../website/templates/pages/unsubscribed.html | 11 ++ 21 files changed, 70 insertions(+), 562 deletions(-) delete mode 100644 erpnext/website/doctype/blog_subscriber/__init__.py delete mode 100644 erpnext/website/doctype/blog_subscriber/blog_subscriber.txt delete mode 100644 erpnext/website/page/unsubscribe/__init__.py delete mode 100644 erpnext/website/page/unsubscribe/unsubscribe.html delete mode 100644 erpnext/website/page/unsubscribe/unsubscribe.js delete mode 100644 erpnext/website/page/unsubscribe/unsubscribe.py delete mode 100644 erpnext/website/page/unsubscribe/unsubscribe.txt create mode 100644 erpnext/website/templates/pages/unsubscribed.html diff --git a/erpnext/home/doctype/home_control/home_control.py b/erpnext/home/doctype/home_control/home_control.py index fba711e6420..b1ddda40119 100644 --- a/erpnext/home/doctype/home_control/home_control.py +++ b/erpnext/home/doctype/home_control/home_control.py @@ -118,22 +118,6 @@ class DocType: out[dt][s[0]] = cint(cnt) return out - def send_feedback(self, args): - args = json.loads(args) - - fb_sender = sql("select concat_ws(' ',first_name, last_name), email from tabProfile where name=%s", session['user']) - fb_subject = 'Feedback : ' + args['subject'] - - - fb_msg = ''' -
-
%s wrote,
-
%s
-
- ''' % (fb_sender[0][0], args['feedback']) - - sendmail('info@webnotestech.com', fb_sender[0][1], msg = fb_msg, subject=args['subject'],parts=[], cc=[], attach=[]) - def get_dt_help(self,dt): return sql("select description from tabDocType where name=%s",dt)[0][0] or '' diff --git a/erpnext/projects/doctype/project_control/project_control.py b/erpnext/projects/doctype/project_control/project_control.py index 0dcd1a94f27..9928ffd35a8 100644 --- a/erpnext/projects/doctype/project_control/project_control.py +++ b/erpnext/projects/doctype/project_control/project_control.py @@ -155,7 +155,6 @@ def sent_reminder_task():

If you have already completed this task, please update the system

Good Luck!

(This notification is autogenerated)

""" % i - sendmail(i['allocated_to'], sender='automail@webnotestech.com', msg=msg2,send_now=1, \ - subject='A task has been assigned') + sendmail(i['allocated_to'], msg=msg2, subject='A task has been assigned') sql("update `tabTask` set sent_reminder='1' where name='%(name)s' and allocated_to= '%(allocated_to)s'" % i) diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py index 552a4c86be3..bfd98db1270 100644 --- a/erpnext/projects/doctype/task/task.py +++ b/erpnext/projects/doctype/task/task.py @@ -115,10 +115,7 @@ class DocType:

Expected End Date: %(exp_end_date)s

Details: %(description)s

(This notification is autogenerated)

""" % i - sendmail(self.doc.allocated_to, sender='automail@webnotestech.com', msg=msg2,send_now=1,\ - subject= task_label + self.doc.subject) - - + sendmail(self.doc.allocated_to, msg=msg2,subject= task_label + self.doc.subject) #validate before closing task def validate_for_closed(self): diff --git a/erpnext/selling/doctype/lead/lead.js b/erpnext/selling/doctype/lead/lead.js index 57f2bee1853..504b0bdc7af 100644 --- a/erpnext/selling/doctype/lead/lead.js +++ b/erpnext/selling/doctype/lead/lead.js @@ -110,16 +110,6 @@ cur_frm.cscript['Create Customer'] = function(){ ); } -// send email -// =============================================================== -cur_frm.cscript.send_email = function(doc,cdt,cdn){ - if(doc.__islocal != 1){ - $c_obj(make_doclist(doc.doctype, doc.name),'send_mail','',function(r,rt){}); - }else{ - msgprint("Please save lead first before sending email") - } -} - // Create New Opportunity // =============================================================== cur_frm.cscript['Create Opportunity'] = function(){ diff --git a/erpnext/selling/doctype/lead/lead.py b/erpnext/selling/doctype/lead/lead.py index 166e4fa7065..cdb278ec58e 100644 --- a/erpnext/selling/doctype/lead/lead.py +++ b/erpnext/selling/doctype/lead/lead.py @@ -82,15 +82,9 @@ class DocType: def on_update(self): - # Add to calendar - # ======================================================================== if self.doc.contact_by: self.add_calendar_event() - if session['user'] == 'Guest': - if self.doc.email_id: - self.send_email_notification() - if not self.doc.naming_series: if session['user'] == 'Guest': import webnotes.model.doctype @@ -102,37 +96,6 @@ class DocType: else: msgprint("Please specify naming series") raise Exception - - def send_email_notification(self): - if not validate_email_add(self.doc.email_id.strip(' ')): - msgprint('error:%s is not a valid email id' % self.doc.email_id.strip(' ')) - raise Exception - else: - subject = 'Thank you for interest in erpnext' - - sendmail([self.doc.email_id.strip(' ')], sender = sender_email[0][0], subject = subject , parts = [['text/html', self.get_notification_msg()]]) - msgprint("Mail Sent") - - def get_notification_msg(self): - t = """ - - - Dear %s,

- - Thank you for contacting us.

- - You have left following message for us,
- %s -

- - You will receive reply on this shortly.

- - Cheers! - - - """ % (self.doc.lead_name, self.doc.remark) - - return t # Add to Calendar # =========================================================================== @@ -157,25 +120,6 @@ class DocType: ev.ref_name = self.doc.name ev.save(1) - -#-----------------Email-------------------------------------------- - def send_emails(self, email=[], subject='', message=''): - if email: - sendmail(email, sender = webnotes.user.name, subject = subject , parts = [['text/html', message]]) - msgprint("Mail Sent") - self.add_in_follow_up(message,'Email') - -#-------------------------Checking Sent Mails Details---------------------------------------------- - def send_mail(self): - if not self.doc.subject or not self.doc.message: - msgprint("Please enter subject & message in their respective fields.") - elif not self.doc.email_id: - msgprint("Recipient not specified. Please add email id of lead in 'Email id' field provided in 'Contact Info' section.") - raise Exception - else : - self.send_emails([self.doc.email_id.strip(' ')], subject = self.doc.subject ,message = self.doc.message) - -#---------------------- Add details in follow up table---------------- def add_in_follow_up(self,message,type): import datetime child = addchild( self.doc, 'follow_up', 'Communication Log', 1, self.doclist) diff --git a/erpnext/selling/doctype/lead/lead.txt b/erpnext/selling/doctype/lead/lead.txt index b6aa8397d7d..a467f3af18c 100644 --- a/erpnext/selling/doctype/lead/lead.txt +++ b/erpnext/selling/doctype/lead/lead.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-05-15 12:14:52', + 'creation': '2012-06-05 20:03:20', 'docstatus': 0, - 'modified': '2012-05-30 12:43:03', + 'modified': '2012-08-02 18:01:53', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -505,23 +505,6 @@ 'permlevel': 0 }, - # DocField - { - 'colour': u'White:FFF', - 'description': u'Probability of lead converting to customer', - 'doctype': u'DocField', - 'fieldname': u'rating', - 'fieldtype': u'Select', - 'in_filter': 1, - 'label': u'Rating', - 'oldfieldname': u'rating', - 'oldfieldtype': u'Select', - 'options': u'\nHot\nWarm\nCold', - 'permlevel': 0, - 'reqd': 0, - 'search_index': 0 - }, - # DocField { 'default': u'__user', @@ -694,5 +677,14 @@ 'oldfieldtype': u'Small Text', 'permlevel': 1, 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'unsubscribed', + 'fieldtype': u'Check', + 'label': u'Unsubscribed', + 'permlevel': 0 } ] \ No newline at end of file diff --git a/erpnext/selling/doctype/lead/lead_list.js b/erpnext/selling/doctype/lead/lead_list.js index ca18dc6941b..b876d52cbb6 100644 --- a/erpnext/selling/doctype/lead/lead_list.js +++ b/erpnext/selling/doctype/lead/lead_list.js @@ -4,8 +4,7 @@ wn.doclistviews['Lead'] = wn.views.ListView.extend({ this.fields = this.fields.concat([ 'tabLead.lead_name', 'tabLead.status', - 'tabLead.source', - 'tabLead.rating' + 'tabLead.source' ]); this.stats = this.stats.concat(['status', 'source', 'rating', 'company']); }, diff --git a/erpnext/selling/doctype/opportunity/opportunity.py b/erpnext/selling/doctype/opportunity/opportunity.py index 1bcde250599..20dcef386a8 100644 --- a/erpnext/selling/doctype/opportunity/opportunity.py +++ b/erpnext/selling/doctype/opportunity/opportunity.py @@ -197,118 +197,7 @@ class DocType(TransactionBase): set(self.doc, 'status', 'Opportunity Lost') set(self.doc, 'order_lost_reason', arg) return 'true' - - - # On Send Email - # ==================================================================================================================== - #def send_emails(self,email,sender,subject,message): - # if email: - # sendmail(email,sender,subject=subject or 'Opportunity',parts=[['text/plain',message or self.get_enq_summary()]]) - - # Prepare HTML Table and Enter Opportunity Items in it, which will be added in enq summary - # ==================================================================================================================== - def quote_table(self): - if getlist(self.doclist,'enq_details'): - header_lbl = ['Item Code','Item Name','Description','Reqd Qty','UOM'] - item_tbl = '''''' - for i in header_lbl: - item_header = '''''' % i - item_tbl += item_header - item_tbl += '''''' - - for d in getlist(self.doclist,'enq_details'): - item_det = ''' - - - - - - ''' % (d.item_code,d.item_name,d.description,d.reqd_qty,d.uom) - item_tbl += item_det - item_tbl += '''
%s
%s%s%s%s%s
''' - return item_tbl - - # Prepare HTML Page containing summary of Opportunity, which will be sent as message in E-mail - # ==================================================================================================================== - def get_enq_summary(self): - - t = """ - - -
-
Request For Quotation
-
%(from_company)s
-
%(company_address)s
-
- -
Quotation Items
-
- - - -
Opportunity No: %(name)s
Opening Date: %(transaction_date)s
Expected By Date: %(expected_date)s
-
- -
Terms and Conditions
-
%(terms_and_conditions)s
- -
Contact Details
-
- - - -
Contact Person: %(contact_person)s
Contact No: %(contact_no)s
Email: %(email)s
- """ % (self.doc.fields) - - t += """
Quotation Items
%s
-
-To login into the system, use link :
http://67.205.111.118/v160/login.html


-
- - - """ % (self.quote_table()) - return t - - #-----------------Email-------------------------------------------- - # ==================================================================================================================== - def send_emails(self, email=[], subject='', message=''): - if email: - sender_email= sql("Select email from `tabProfile` where name='%s'"%session['user']) - if sender_email and sender_email[0][0]: - attach_list=[] - for at in getlist(self.doclist,'enquiry_attachment_detail'): - if at.select_file: - attach_list.append(at.select_file) - cc_list=[] - if self.doc.cc_to: - for cl in (self.doc.cc_to.split(',')): - if not validate_email_add(cl.strip(' ')): - msgprint('error:%s is not a valid email id' % cl.strip(' ')) - raise Exception - cc_list.append(cl.strip(' ')) - sendmail(cc_list, sender=sender_email[0][0], subject=subject, parts=[['text/html', message]], attach=attach_list) - sendmail(email, sender=sender_email[0][0], subject=subject, parts=[['text/html', message]], cc=cc_list, attach=attach_list) - #sendmail(cc_list, sender = sender_email[0][0], subject = subject , parts = [['text/html', message]],attach=attach_list) - msgprint("Mail has been sent") - self.add_in_follow_up(message,'Email') - else: - msgprint("Please enter your mail id in Profile") - raise Exception - - #-------------------------Checking Sent Mails Details---------------------------------------------- - # ==================================================================================================================== - def sent_mail(self): - if not self.doc.subject or not self.doc.message: - msgprint("Please enter subject & message in their respective fields.") - elif not self.doc.email_id1: - msgprint("Recipient not specified. Please add email id in 'Send To'.") - raise Exception - else : - if not validate_email_add(self.doc.email_id1.strip(' ')): - msgprint('error:%s is not a valid email id' % self.doc.email_id1) - else: - self.send_emails([self.doc.email_id1.strip(' ')], subject = self.doc.subject ,message = self.doc.message) - + #---------------------- Add details in follow up table---------------- # ==================================================================================================================== def add_in_follow_up(self,message,type): diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py index 1e382d198da..ac0f37844aa 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.py +++ b/erpnext/setup/doctype/email_digest/email_digest.py @@ -415,7 +415,6 @@ class DocType: from webnotes.utils.email_lib import sendmail try: - #webnotes.msgprint('in send') sendmail( recipients=recipient_list, sender='notifications+email_digest@erpnext.com', diff --git a/erpnext/setup/doctype/email_settings/email_settings.py b/erpnext/setup/doctype/email_settings/email_settings.py index 118dba2e1c3..cb2865706c9 100644 --- a/erpnext/setup/doctype/email_settings/email_settings.py +++ b/erpnext/setup/doctype/email_settings/email_settings.py @@ -24,44 +24,24 @@ class DocType: self.doc,self.doclist = doc,doclist def validate(self): - """ - Checks connectivity to email servers before saving - """ + """Checks connectivity to email servers before saving""" self.validate_outgoing() self.validate_incoming() - def validate_outgoing(self): - """ - Checks incoming email settings - """ + """Checks incoming email settings""" if self.doc.outgoing_mail_server: from webnotes.utils import cint - import _socket - from webnotes.utils.email_lib.send import EMail - import smtplib - out_email = EMail() - out_email.server = self.doc.outgoing_mail_server.encode('utf-8') - 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(err_msg) - raise e + from webnotes.utils.email_lib.smtp import SMTPServer + smtpserver = SMTPServer(login = self.doc.mail_login, + password = self.doc.mail_password, + server = self.doc.outgoing_mail_server, + port = cint(self.doc.mail_port), + use_ssl = self.doc.use_ssl + ) - # exceptions are handled in smtp_connect - sess = out_email.smtp_connect() - - try: - sess.quit() - except: - pass - + # exceptions are handled in session connect + sess = smtpserver.sess def validate_incoming(self): """ diff --git a/erpnext/startup/schedule_handlers.py b/erpnext/startup/schedule_handlers.py index a828feafafb..021cb1f6009 100644 --- a/erpnext/startup/schedule_handlers.py +++ b/erpnext/startup/schedule_handlers.py @@ -24,27 +24,26 @@ def execute_all(): * get support email * recurring invoice """ - try: - from support.doctype.support_ticket import get_support_mails - get_support_mails() - except Exception, e: - scheduler.log('get_support_mails') - - try: - from accounts.doctype.gl_control.gl_control import manage_recurring_invoices - manage_recurring_invoices() - except Exception, e: - scheduler.log('manage_recurring_invoices') + # pull emails + from support.doctype.support_ticket import get_support_mails + run_fn(get_support_mails) + # run recurring invoices + from accounts.doctype.gl_control.gl_control import manage_recurring_invoices + run_fn(manage_recurring_invoices) + # bulk email + from webnotes.utils.email_lib.bulk import flush + run_fn(flush) def execute_daily(): - """email digest""" - try: - from setup.doctype.email_digest.email_digest import send - send() - except Exception, e: - scheduler.log('email_digest.send') + # email digest + from setup.doctype.email_digest.email_digest import send + run_fn(send) + + # send bulk emails + from webnotes.utils.email_lib.bulk import cleanup + run_fn(clear_outbox) def execute_weekly(): pass @@ -54,3 +53,9 @@ def execute_monthly(): def execute_hourly(): pass + +def run_fn(fn): + try: + fn() + except Exception, e: + scheduler.log(fn.func_name) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 9864fc909f0..9e00dc12bfe 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -181,27 +181,6 @@ class DocType: self.doc.is_asset_item = 'No' raise Exception - def check_min_inventory_level(self): - if self.doc.minimum_inventory_level: - total_qty = sql("select sum(projected_qty) from tabBin where item_code = %s",self.doc.name) - if flt(total_qty) < flt(self.doc.minimum_inventory_level): - msgprint("Your minimum inventory level is reached") - send_to = [] - send = sql("select t1.email from `tabProfile` t1,`tabUserRole` t2 where t2.role IN ('Material Master Manager','Purchase Manager') and t2.parent = t1.name") - for d in send: - send_to.append(d[0]) - msg = ''' -Minimum Inventory Level Reached - -Item Code: %s -Item Name: %s -Minimum Inventory Level: %s -Total Available Qty: %s - -''' % (self.doc.item_code, self.doc.item_name, self.doc.minimum_inventory_level, total_qty) - - sendmail(send_to, sender='automail@webnotestech.com', subject='Minimum Inventory Level Reached', parts=[['text/plain', msg]]) - def get_file_details(self, arg = ''): file = sql("select file_group, description from tabFile where name = %s", eval(arg)['file_name'], as_dict = 1) diff --git a/erpnext/utilities/doctype/contact/contact.txt b/erpnext/utilities/doctype/contact/contact.txt index 135699b7689..baa2a775eed 100644 --- a/erpnext/utilities/doctype/contact/contact.txt +++ b/erpnext/utilities/doctype/contact/contact.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-07-02 19:57:48', + 'creation': '2012-07-03 14:22:38', 'docstatus': 0, - 'modified': '2012-07-03 12:54:52', + 'modified': '2012-08-02 13:16:48', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -38,133 +38,12 @@ 'parenttype': u'DocType' }, - # These values are common for all DocPerm - { - 'doctype': u'DocPerm', - 'name': '__common__', - 'parent': u'Contact', - 'parentfield': u'permissions', - 'parenttype': u'DocType', - 'read': 1 - }, - # DocType, Contact { 'doctype': 'DocType', 'name': u'Contact' }, - # DocPerm - { - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'System Manager', - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales Master Manager', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Purchase Master Manager', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales Manager', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Purchase Manager', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Maintenance Manager', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Accounts Manager', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales User', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Purchase User', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Maintenance User', - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Accounts User', - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'All' - }, - # DocField { 'colour': u'White:FFF', @@ -356,6 +235,15 @@ 'permlevel': 0 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'unsubscribed', + 'fieldtype': u'Check', + 'label': u'Unsubscribed', + 'permlevel': 0 + }, + # DocField { 'doctype': u'DocField', diff --git a/erpnext/website/doctype/blog_subscriber/__init__.py b/erpnext/website/doctype/blog_subscriber/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/erpnext/website/doctype/blog_subscriber/blog_subscriber.txt b/erpnext/website/doctype/blog_subscriber/blog_subscriber.txt deleted file mode 100644 index 1fa8223cd04..00000000000 --- a/erpnext/website/doctype/blog_subscriber/blog_subscriber.txt +++ /dev/null @@ -1,29 +0,0 @@ -# DocType, Blog Subscriber -[ - - # These values are common in all dictionaries - { - 'creation': '2012-03-27 14:36:47', - 'docstatus': 0, - 'modified': '2012-03-27 14:36:47', - 'modified_by': u'Administrator', - 'owner': u'Administrator' - }, - - # These values are common for all DocType - { - 'colour': u'White:FFF', - 'doctype': 'DocType', - 'module': u'Website', - 'name': '__common__', - 'section_style': u'Simple', - 'show_in_menu': 0, - 'version': 1 - }, - - # DocType, Blog Subscriber - { - 'doctype': 'DocType', - 'name': u'Blog Subscriber' - } -] \ No newline at end of file diff --git a/erpnext/website/page/unsubscribe/__init__.py b/erpnext/website/page/unsubscribe/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/erpnext/website/page/unsubscribe/unsubscribe.html b/erpnext/website/page/unsubscribe/unsubscribe.html deleted file mode 100644 index 7b2b68ee9c6..00000000000 --- a/erpnext/website/page/unsubscribe/unsubscribe.html +++ /dev/null @@ -1,13 +0,0 @@ -
-
-

Unsubscribe

-
-
- - -
-
-
-
-
-
\ No newline at end of file diff --git a/erpnext/website/page/unsubscribe/unsubscribe.js b/erpnext/website/page/unsubscribe/unsubscribe.js deleted file mode 100644 index 9e83020a98c..00000000000 --- a/erpnext/website/page/unsubscribe/unsubscribe.js +++ /dev/null @@ -1,37 +0,0 @@ -// ERPNext - web based ERP (http://erpnext.com) -// Copyright (C) 2012 Web Notes Technologies Pvt Ltd -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -pscript.onload_unsubscribe = function(wrapper) { - var email = window.location.hash.split('/').splice(-1); - $(wrapper).find('input[name="unsubscribe"]').val(email) - - $('#btn-unsubscribe').click(function() { - var email = $(wrapper).find('input[name="unsubscribe"]').val(); - if(email) { - var btn = this; - wn.call({ - module:'website', - page:'unsubscribe', - method:'unsubscribe', - args:email, - btn: this, - callback: function() { - $(wrapper).find('input[name="unsubscribe"]').val(''); - } - }); - } - }); -} \ No newline at end of file diff --git a/erpnext/website/page/unsubscribe/unsubscribe.py b/erpnext/website/page/unsubscribe/unsubscribe.py deleted file mode 100644 index 9985ded4a8b..00000000000 --- a/erpnext/website/page/unsubscribe/unsubscribe.py +++ /dev/null @@ -1,26 +0,0 @@ -# ERPNext - web based ERP (http://erpnext.com) -# Copyright (C) 2012 Web Notes Technologies Pvt Ltd -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import webnotes - -@webnotes.whitelist() -def unsubscribe(arg): - """unsubscribe from lists""" - lists = [['Blog Subscriber', 'name']] - for l in lists: - webnotes.conn.sql("""delete from `tab%s` where %s=%s""" % (l[0], l[1], '%s'), arg) - - webnotes.msgprint('Unsubscribed!') \ No newline at end of file diff --git a/erpnext/website/page/unsubscribe/unsubscribe.txt b/erpnext/website/page/unsubscribe/unsubscribe.txt deleted file mode 100644 index 2cc3b58a351..00000000000 --- a/erpnext/website/page/unsubscribe/unsubscribe.txt +++ /dev/null @@ -1,43 +0,0 @@ -# Page, unsubscribe -[ - - # These values are common in all dictionaries - { - 'creation': '2012-01-27 17:19:02', - 'docstatus': 0, - 'modified': '2012-01-27 17:19:02', - 'modified_by': 'Administrator', - 'owner': 'Administrator' - }, - - # These values are common for all Page - { - 'doctype': 'Page', - 'module': 'Website', - 'name': '__common__', - 'page_name': 'unsubscribe', - 'standard': 'Yes', - 'title': 'Unsubscribe' - }, - - # These values are common for all Page Role - { - 'doctype': 'Page Role', - 'name': '__common__', - 'parent': 'unsubscribe', - 'parentfield': 'roles', - 'parenttype': 'Page', - 'role': 'Guest' - }, - - # Page, unsubscribe - { - 'doctype': 'Page', - 'name': 'unsubscribe' - }, - - # Page Role - { - 'doctype': 'Page Role' - } -] \ No newline at end of file diff --git a/erpnext/website/templates/pages/unsubscribed.html b/erpnext/website/templates/pages/unsubscribed.html new file mode 100644 index 00000000000..3dc7df9e438 --- /dev/null +++ b/erpnext/website/templates/pages/unsubscribed.html @@ -0,0 +1,11 @@ +{% extends "html/outer.html" %} + +{% block content %} +
+
+

Unsubscribed

+
+

{{ webnotes.unsubscribed_email }} has been unsubscribed.

+
+
+{% endblock %} \ No newline at end of file