Skip to content

Commit

Permalink
fix: skip setting of contact full name if its too long (#25509)
Browse files Browse the repository at this point in the history
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
(cherry picked from commit 6c767bf)
  • Loading branch information
akhilnarang authored and mergify[bot] committed Mar 18, 2024
1 parent fe3244c commit d5685d7
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions frappe/patches/v15_0/set_contact_full_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ def execute():
total = len(contacts)
for idx, (name, first, middle, last, company) in enumerate(contacts):
update_progress_bar("Setting full name for contacts", idx, total)
frappe.db.set_value(
"Contact",
name,
"full_name",
get_full_name(first, middle, last, company),
update_modified=False,
)
try:
frappe.db.set_value(
"Contact",
name,
"full_name",
get_full_name(first, middle, last, company),
update_modified=False,
)
except frappe.db.DataError as e:
if frappe.db.is_data_too_long(e):
print("Full name is too long for DB column, skipping")
continue
raise e

0 comments on commit d5685d7

Please sign in to comment.