[cleanup] added unsubscribe to email digest
This commit is contained in:
parent
174299124f
commit
73f1dc4edf
@ -247,7 +247,7 @@
|
|||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"description": "Income booked for the digest period",
|
"description": "",
|
||||||
"fieldname": "income",
|
"fieldname": "income",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -269,7 +269,7 @@
|
|||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"description": "Expenses booked for the digest period",
|
"description": "",
|
||||||
"fieldname": "expenses_booked",
|
"fieldname": "expenses_booked",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -291,7 +291,7 @@
|
|||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"description": "Balances of Accounts of type \"Bank\" or \"Cash\"",
|
"description": "",
|
||||||
"fieldname": "bank_balance",
|
"fieldname": "bank_balance",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -428,7 +428,7 @@
|
|||||||
"is_submittable": 0,
|
"is_submittable": 0,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"modified": "2015-10-02 07:07:25.518002",
|
"modified": "2015-10-02 07:33:27.334888",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Setup",
|
"module": "Setup",
|
||||||
"name": "Email Digest",
|
"name": "Email Digest",
|
||||||
|
@ -56,9 +56,14 @@ class EmailDigest(Document):
|
|||||||
frappe.set_user(user_id)
|
frappe.set_user(user_id)
|
||||||
msg_for_this_receipient = self.get_msg_html()
|
msg_for_this_receipient = self.get_msg_html()
|
||||||
if msg_for_this_receipient:
|
if msg_for_this_receipient:
|
||||||
frappe.sendmail(recipients=user_id,
|
frappe.sendmail(
|
||||||
|
recipients=user_id,
|
||||||
subject="{frequency} Digest".format(frequency=self.frequency),
|
subject="{frequency} Digest".format(frequency=self.frequency),
|
||||||
message=msg_for_this_receipient, bulk=True)
|
message=msg_for_this_receipient,
|
||||||
|
bulk=True,
|
||||||
|
reference_doctype = self.doctype,
|
||||||
|
reference_name = self.name,
|
||||||
|
unsubscribe_message = _("Unsubscribe from this Email Digest"))
|
||||||
|
|
||||||
frappe.set_user(original_user)
|
frappe.set_user(original_user)
|
||||||
|
|
||||||
@ -76,6 +81,9 @@ class EmailDigest(Document):
|
|||||||
context.todo_list = self.get_todo_list()
|
context.todo_list = self.get_todo_list()
|
||||||
context.notifications = self.get_notifications()
|
context.notifications = self.get_notifications()
|
||||||
|
|
||||||
|
if not (context.events or context.todo_list or context.notifications or context.cards):
|
||||||
|
return None
|
||||||
|
|
||||||
# style
|
# style
|
||||||
return frappe.render_template("erpnext/setup/doctype/email_digest/templates/default.html",
|
return frappe.render_template("erpnext/setup/doctype/email_digest/templates/default.html",
|
||||||
context, is_path=True)
|
context, is_path=True)
|
||||||
@ -110,7 +118,7 @@ class EmailDigest(Document):
|
|||||||
lambda a, b: 1 if a[1] < b[1] else -1)
|
lambda a, b: 1 if a[1] < b[1] else -1)
|
||||||
|
|
||||||
notifications = [{"key": n[0], "value": n[1],
|
notifications = [{"key": n[0], "value": n[1],
|
||||||
"link": get_url_to_list(n[0])} for n in notifications]
|
"link": get_url_to_list(n[0])} for n in notifications if n[1]]
|
||||||
|
|
||||||
return notifications
|
return notifications
|
||||||
|
|
||||||
|
@ -88,10 +88,9 @@
|
|||||||
|
|
||||||
<!-- notifications -->
|
<!-- notifications -->
|
||||||
{% if notifications %}
|
{% if notifications %}
|
||||||
<h4 style="{{ section_head }}">{{ _("Pending Activities") }}</h4>
|
<h4 style="{{ section_head }}">{{ _("Open Notifications") }}</h4>
|
||||||
<div>
|
<div>
|
||||||
{% for n in notifications %}
|
{% for n in notifications %}
|
||||||
{% if n.value %}
|
|
||||||
<div style="{{ line_item }}">
|
<div style="{{ line_item }}">
|
||||||
<table style="width: 100%;">
|
<table style="width: 100%;">
|
||||||
<tr>
|
<tr>
|
||||||
@ -106,7 +105,6 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user