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