From f29a618b6938534681841a3c8d88c1ccd4179bfa Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 25 May 2015 10:50:48 +0530 Subject: [PATCH] [email] [website] footer cleanup --- .../doctype/journal_entry/journal_entry.py | 6 +- erpnext/crm/doctype/newsletter/newsletter.py | 47 +++++++- .../newsletter_list/newsletter_list.py | 4 +- erpnext/hooks.py | 7 +- erpnext/patches.txt | 3 +- erpnext/public/images/erpnext-fade.png | Bin 516 -> 0 bytes erpnext/public/images/erpnext-logo-white.svg | 112 ------------------ erpnext/public/images/erpnext1.png | Bin 429 -> 0 bytes erpnext/public/images/feed.png | Bin 691 -> 0 bytes erpnext/public/js/website_utils.js | 12 +- .../setup/page/setup_wizard/setup_wizard.py | 1 + erpnext/stock/doctype/item/item.json | 3 +- .../templates/includes/footer_extension.html | 41 ------- .../templates/includes/footer_powered.html | 1 - 14 files changed, 71 insertions(+), 166 deletions(-) delete mode 100644 erpnext/public/images/erpnext-fade.png delete mode 100644 erpnext/public/images/erpnext-logo-white.svg delete mode 100644 erpnext/public/images/erpnext1.png delete mode 100755 erpnext/public/images/feed.png delete mode 100644 erpnext/templates/includes/footer_extension.html delete mode 100644 erpnext/templates/includes/footer_powered.html diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 6317793538..1e2b352d4e 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -76,9 +76,9 @@ class JournalEntry(AccountsController): account_type = frappe.db.get_value("Account", d.account, "account_type") if account_type in ["Receivable", "Payable"]: if not (d.party_type and d.party): - frappe.throw(_("Row{0}: Party Type and Party is required for Receivable / Payable account {1}").format(d.idx, d.account)) + frappe.throw(_("Row {0}: Party Type and Party is required for Receivable / Payable account {1}").format(d.idx, d.account)) elif d.party_type and d.party: - frappe.throw(_("Row{0}: Party Type and Party is only applicable against Receivable / Payable account").format(d.idx)) + frappe.throw(_("Row {0}: Party Type and Party is only applicable against Receivable / Payable account").format(d.idx)) def check_credit_limit(self): customers = list(set([d.party for d in self.get("accounts") if d.party_type=="Customer" and flt(d.debit) > 0])) @@ -438,7 +438,7 @@ class JournalEntry(AccountsController): if self.stock_entry: if frappe.db.get_value("Stock Entry", self.stock_entry, "docstatus") != 1: frappe.throw(_("Stock Entry {0} is not submitted").format(self.stock_entry)) - + if frappe.db.exists({"doctype": "Journal Entry", "stock_entry": self.stock_entry, "docstatus":1}): frappe.msgprint(_("Warning: Another {0} # {1} exists against stock entry {2}".format(self.voucher_type, self.name, self.stock_entry))) diff --git a/erpnext/crm/doctype/newsletter/newsletter.py b/erpnext/crm/doctype/newsletter/newsletter.py index 0bafda6881..30fd101e35 100644 --- a/erpnext/crm/doctype/newsletter/newsletter.py +++ b/erpnext/crm/doctype/newsletter/newsletter.py @@ -8,7 +8,9 @@ import frappe.utils from frappe import throw, _ from frappe.model.document import Document from frappe.email.bulk import check_bulk_limit +from frappe.utils.verified_command import get_signed_params, verify_request import erpnext.tasks +from erpnext.crm.doctype.newsletter_list.newsletter_list import add_subscribers class Newsletter(Document): def onload(self): @@ -87,7 +89,6 @@ def get_lead_options(): @frappe.whitelist(allow_guest=True) def unsubscribe(email, name): - from frappe.utils.verified_command import verify_request if not verify_request(): return @@ -123,3 +124,47 @@ def create_lead(email_id): "source": "Email" }) lead.insert() + + +@frappe.whitelist(allow_guest=True) +def subscribe(email): + url = frappe.utils.get_url("/api/method/erpnext.crm.doctype.newsletter.newsletter.confirm_subscription") +\ + "?" + get_signed_params({"email": email}) + + messages = ( + _("Thank you for your interest in subscribing to our updates"), + _("Please verify your email id"), + url, + _("Click here to verify") + ) + + print url + + content = """ +

{0}. {1}.

+

{3}

+ """ + + frappe.sendmail(email, subject=_("Confirm Your Email"), content=content.format(*messages), bulk=True) + +@frappe.whitelist(allow_guest=True) +def confirm_subscription(email): + if not verify_request(): + return + + if not frappe.db.exists("Newsletter List", _("Website")): + frappe.get_doc({ + "doctype": "Newsletter List", + "title": _("Website") + }).insert(ignore_permissions=True) + + + frappe.flags.ignore_permissions = True + + add_subscribers(_("Website"), email) + frappe.db.commit() + + frappe.respond_as_web_page(_("Confirmed"), _("{0} has been successfully added to our Newsletter list.").format(email)) + + + diff --git a/erpnext/crm/doctype/newsletter_list/newsletter_list.py b/erpnext/crm/doctype/newsletter_list/newsletter_list.py index e4ba6b1ad4..1eb95eac17 100644 --- a/erpnext/crm/doctype/newsletter_list/newsletter_list.py +++ b/erpnext/crm/doctype/newsletter_list/newsletter_list.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document -from frappe.utils import validate_email_add, strip +from frappe.utils import validate_email_add from frappe import _ from email.utils import parseaddr @@ -75,7 +75,7 @@ def add_subscribers(name, email_list): "doctype": "Newsletter List Subscriber", "newsletter_list": name, "email": email - }).insert() + }).insert(ignore_permissions = frappe.flags.ignore_permissions) count += 1 else: diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 74631d170a..bc7f9d5c44 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -96,9 +96,10 @@ scheduler_events = { ] } -default_mail_footer = """
- - Sent via ERPNext +default_mail_footer = """
+ + Sent via ERPNext
""" diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 65a6de4348..fcf0ea7d69 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -156,4 +156,5 @@ erpnext.patches.v5_0.repost_requested_qty erpnext.patches.v5_0.fix_taxes_and_totals_in_party_currency erpnext.patches.v5_0.update_tax_amount_after_discount_in_purchase_cycle erpnext.patches.v5_0.rename_pos_setting -erpnext.patches.v5_0.update_operation_description \ No newline at end of file +erpnext.patches.v5_0.update_operation_description +erpnext.patches.v5_0.set_footer_address diff --git a/erpnext/public/images/erpnext-fade.png b/erpnext/public/images/erpnext-fade.png deleted file mode 100644 index 81cc41036a838e7857ff2c34635c660183670ff6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 516 zcmV+f0{i`mP)Oc*c1{Mi^oOQ)rve;+JGuE}t`52mK&Hwk_V*iQ?bC6|S9?I(z5)-$-u#*CP{**wdFOnI9HLt64( zqjmzFKpTOgz&heD1hOqaTDGM;tx04p3x~icQK+foC*XiM9hLKDne#rB%fb?Ig31~g zuO@QZeF=o^=vmpzPK?37P1d;pZU^;}R8m{=z~15_O_p7t8+A_LzYxfN zq2*~A)w}}DMtwtk1gUn>NTvgDM+$z)y#~3z{C(P&00RJSLu@Zsc3CI@0000 - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/erpnext/public/images/erpnext1.png b/erpnext/public/images/erpnext1.png deleted file mode 100644 index cfc3d84d24b386320b1540022f5c1e0b1f4dc6e1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 429 zcmV;e0aE^nP)bj2ghn19Rzz~3F_8{5fI3i- z1U*9|ibowd>cCM44krixB~s5{64jHc76mXO)x}OgtU^QyzXphZK@070AZ8}Qp7lWd z8i+-KIFQJiWEr{xN7Eps4!j4%{|Vr4K&%B-Z%>4J7>*@T&sA&=6e7YyoX`p%1f)p_ z2x$`aXpNSGqYfN(;HU!!abw{fl>SbFJ>N;x^A1~ML6L~U`a85o2Lr_R&@Mw87{uy% z0mM&-L}P&kt$N`kAv8FVt0V&84iJAN%Y~p2gyOgVi31)`^&$U>2c<~%kc5#l2{Vy? zf~jL8Asm=T%fV3xjyiDEfrAtvS9N|2#Er5phStfTj(Zf5_H2UIuM|0OG>XXq009O7 XRgdXzxd!b<00000NkvXXu0mjfQUs*H diff --git a/erpnext/public/images/feed.png b/erpnext/public/images/feed.png deleted file mode 100755 index 315c4f4fa62cb720326ba3f54259666ba3999e42..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 691 zcmV;k0!;mhP)bpQb1=l6TxbDZwj&S={?7%qx-u`rsG(Zp`-rh=e^=%((1yvsuf5d=&62Zj)Y zH&JviNS_F4_Hj|T(1j4$p-!}kixP9&dB4uv^MveG?dGf%sUCoc2!IFxD6wHRA2^dX zXRVk!-qSfk(jcaUKn#RP48(whfPlJUpApdrA!TQi_4D+fVoM;3I0gZ8{=Xv~Po;geVA+Em9@0Wq2 zr>OTZEGR05L=gf1T;ucCxq6Q6EgJiH@@-lVaAlQyw`jIF^c=&IVnj|95hHbE_cnt| zTzZQ?F4Ne@(bH(~&3nM%m)I@ID{@jJ2qZPjr)jhpe9hViOwH5k&|T#EmmL3(vHeUQ zq^!t^Al6JD;=mHq^Bg?J-8-zG2Od7gZbknG;K9czYjPqG*xjPo0k(c4%lPXTpw(qq z@aGMnxtFS(np+2kC} z7P02O874ZkJH$v#nCUVx$({yDN`IX@o2wyvTD#e`qN`_w5<}$3F+_ -
-
-
- - - - -
-
-
-
- diff --git a/erpnext/templates/includes/footer_powered.html b/erpnext/templates/includes/footer_powered.html deleted file mode 100644 index 96611813a7..0000000000 --- a/erpnext/templates/includes/footer_powered.html +++ /dev/null @@ -1 +0,0 @@ -ERPNext Powered