mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
fix: validate email address
This commit is contained in:
@@ -308,7 +308,7 @@ class SalesInvoice(SellingController):
|
|||||||
"email": company_details.get("email"),
|
"email": company_details.get("email"),
|
||||||
"address_line": address_line,
|
"address_line": address_line,
|
||||||
"company": self.company,
|
"company": self.company,
|
||||||
"company_address_display": self.company_address,
|
"company_address": self.company_address,
|
||||||
"name": self.name,
|
"name": self.name,
|
||||||
},
|
},
|
||||||
user=frappe.session.user,
|
user=frappe.session.user,
|
||||||
@@ -2839,9 +2839,14 @@ def get_loyalty_programs(customer):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def save_company_master_details(name, company, details):
|
def save_company_master_details(name, company, details):
|
||||||
|
from frappe.utils import validate_email_address
|
||||||
|
|
||||||
if isinstance(details, str):
|
if isinstance(details, str):
|
||||||
details = frappe.parse_json(details)
|
details = frappe.parse_json(details)
|
||||||
|
|
||||||
|
if details.get("email"):
|
||||||
|
validate_email_address(details.email, throw=True)
|
||||||
|
|
||||||
company_fields = ["company_logo", "website", "phone_no", "email"]
|
company_fields = ["company_logo", "website", "phone_no", "email"]
|
||||||
updated_fields = {field: details.get(field) for field in company_fields if details.get(field)}
|
updated_fields = {field: details.get(field) for field in company_fields if details.get(field)}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ frappe.realtime.on("sales_invoice_before_print", (data) => {
|
|||||||
|
|
||||||
if (!beforePrintHandled && route[0] === "print" && route[1] === "Sales Invoice") {
|
if (!beforePrintHandled && route[0] === "print" && route[1] === "Sales Invoice") {
|
||||||
beforePrintHandled = true;
|
beforePrintHandled = true;
|
||||||
|
|
||||||
let companyDetailsDialog = new frappe.ui.Dialog({
|
let companyDetailsDialog = new frappe.ui.Dialog({
|
||||||
title: "Enter Company Details",
|
title: "Enter Company Details",
|
||||||
fields: [
|
fields: [
|
||||||
@@ -33,6 +34,7 @@ frappe.realtime.on("sales_invoice_before_print", (data) => {
|
|||||||
label: "Email",
|
label: "Email",
|
||||||
fieldname: "email",
|
fieldname: "email",
|
||||||
fieldtype: "Data",
|
fieldtype: "Data",
|
||||||
|
options: "Email",
|
||||||
reqd: data.email ? 0 : 1,
|
reqd: data.email ? 0 : 1,
|
||||||
hidden: data.email ? 1 : 0,
|
hidden: data.email ? 1 : 0,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user