From 96ae3639ae09b254c8631d3a6efa51fd9618b249 Mon Sep 17 00:00:00 2001 From: Scott Pouliot Date: Wed, 6 May 2026 17:01:37 -0400 Subject: [PATCH] Fix duplicate name on quote PDF for non-commercial customers Non-commercial individuals have their full name stored in both CompanyName and ContactFirstName/ContactLastName, causing the PDF to render the name twice. Skip the company name line when it matches the assembled contact name. Co-Authored-By: Claude Sonnet 4.6 --- .../Services/PdfService.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/PowderCoating.Application/Services/PdfService.cs b/src/PowderCoating.Application/Services/PdfService.cs index e42a196..eef85a9 100644 --- a/src/PowderCoating.Application/Services/PdfService.cs +++ b/src/PowderCoating.Application/Services/PdfService.cs @@ -497,14 +497,20 @@ public class PdfService : IPdfService if (quote.CustomerId.HasValue) { // Existing customer - if (!string.IsNullOrWhiteSpace(quote.CustomerCompanyName)) - column.Item().Text(quote.CustomerCompanyName).FontSize(10).Bold(); - var contactName = new List(); if (!string.IsNullOrWhiteSpace(quote.CustomerContactFirstName)) contactName.Add(quote.CustomerContactFirstName); if (!string.IsNullOrWhiteSpace(quote.CustomerContactLastName)) contactName.Add(quote.CustomerContactLastName); + var contactFullName = string.Join(" ", contactName); + + // Only show company name when it's distinct from the contact's full name. + // Non-commercial customers store the person's name in CompanyName, which would + // otherwise render twice (e.g. "Bryndon Lee" bold + "Bryndon Lee" regular). + if (!string.IsNullOrWhiteSpace(quote.CustomerCompanyName) && + !string.Equals(quote.CustomerCompanyName.Trim(), contactFullName.Trim(), StringComparison.OrdinalIgnoreCase)) + column.Item().Text(quote.CustomerCompanyName).FontSize(10).Bold(); + if (contactName.Any()) - column.Item().Text(string.Join(" ", contactName)).FontSize(9); + column.Item().Text(contactFullName).FontSize(9); if (!string.IsNullOrWhiteSpace(quote.CustomerEmail)) column.Item().Text(quote.CustomerEmail).FontSize(9);