From 1194c6ef4bdfd871099bd469b1fd11e4db8c1207 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 16 Sep 2015 19:20:55 +0530 Subject: [PATCH] [fix] use the new split_emails method to split emails by comma --- erpnext/controllers/recurring_document.py | 7 +++---- erpnext/crm/doctype/newsletter/newsletter.py | 2 +- erpnext/hooks.py | 2 +- erpnext/setup/doctype/backup_manager/backup_manager.py | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/erpnext/controllers/recurring_document.py b/erpnext/controllers/recurring_document.py index f9ab50965c..9edac2e803 100644 --- a/erpnext/controllers/recurring_document.py +++ b/erpnext/controllers/recurring_document.py @@ -4,7 +4,7 @@ import frappe.utils import frappe.defaults from frappe.utils import add_days, cint, cstr, date_diff, flt, getdate, nowdate, \ - get_first_day, get_last_day, comma_and + get_first_day, get_last_day, comma_and, split_emails from frappe.model.naming import make_autoname from frappe import _, msgprint, throw @@ -33,7 +33,7 @@ def manage_recurring_documents(doctype, next_date=None, commit=True): next_date = next_date or nowdate() date_field = date_field_map[doctype] - + condition = " and ifnull(status, '') != 'Stopped'" if doctype in ("Sales Order", "Purchase Order") else "" recurring_documents = frappe.db.sql("""select name, recurring_id @@ -180,8 +180,7 @@ def convert_to_recurring(doc, posting_date): def validate_notification_email_id(doc): if doc.notification_email_address: - email_list = filter(None, [cstr(email).strip() for email in - doc.notification_email_address.replace("\n", "").split(",")]) + email_list = split_emails(doc.notification_email_address.replace("\n", "")) from frappe.utils import validate_email_add for email in email_list: diff --git a/erpnext/crm/doctype/newsletter/newsletter.py b/erpnext/crm/doctype/newsletter/newsletter.py index 83d3caf37a..800a5abef9 100644 --- a/erpnext/crm/doctype/newsletter/newsletter.py +++ b/erpnext/crm/doctype/newsletter/newsletter.py @@ -20,7 +20,7 @@ class Newsletter(Document): group by status""", (self.doctype, self.name))) or None def test_send(self, doctype="Lead"): - self.recipients = self.test_email_id.split(",") + self.recipients = frappe.utils.split_emails(self.test_email_id) self.send_bulk() frappe.msgprint(_("Scheduled to send to {0}").format(self.test_email_id)) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 56bda40d15..b6692f9be1 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -120,7 +120,7 @@ scheduler_events = { ] } -default_mail_footer = """
+default_mail_footer = """
Sent via ERPNext diff --git a/erpnext/setup/doctype/backup_manager/backup_manager.py b/erpnext/setup/doctype/backup_manager/backup_manager.py index 4b16330868..4ad64f64c3 100644 --- a/erpnext/setup/doctype/backup_manager/backup_manager.py +++ b/erpnext/setup/doctype/backup_manager/backup_manager.py @@ -4,7 +4,7 @@ # For license information, please see license.txt from __future__ import unicode_literals -from frappe.utils import get_site_path, cint +from frappe.utils import get_site_path, cint, split_emails from frappe.utils.data import convert_utc_to_user_timezone import os import datetime @@ -98,5 +98,5 @@ def send_email(success, service_name, error_status=None): if not frappe.db: frappe.connect() - recipients = frappe.db.get_value("Backup Manager", None, "send_notifications_to").split(",") + recipients = split_emails(frappe.db.get_value("Backup Manager", None, "send_notifications_to")) frappe.sendmail(recipients=recipients, subject=subject, message=message)