From 68d9432ed8858d0648b3521c8c242ed6051f1135 Mon Sep 17 00:00:00 2001 From: mgtennant <100305096+mgtennant@users.noreply.github.com> Date: Thu, 29 Aug 2024 10:31:41 -0700 Subject: [PATCH] db_tenant_name will include legal names --- backend/src/util.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/backend/src/util.ts b/backend/src/util.ts index 4d7dd195..efbadd50 100644 --- a/backend/src/util.ts +++ b/backend/src/util.ts @@ -345,8 +345,9 @@ export function grazingLeaseVariables( }; } -function getFullName(tenant: { firstName: string; middleName: string; lastName: string }): string { +function getFullName(tenant: { firstName: string; middleName: string; lastName: string; legalName: string }): string { const nameParts = []; + let legalName; if (tenant.firstName !== null) { nameParts.push(tenant.firstName); } @@ -356,7 +357,14 @@ function getFullName(tenant: { firstName: string; middleName: string; lastName: if (tenant.lastName !== null) { nameParts.push(tenant.lastName); } - const fullName = nameParts.join(' '); + if (tenant.legalName !== null) { + legalName = tenant.legalName; + } + + let fullName = nameParts.join(' '); + if (fullName.length === 0 && legalName) { + fullName = legalName; + } return fullName; }