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 <noreply@anthropic.com>
This commit is contained in:
@@ -497,14 +497,20 @@ public class PdfService : IPdfService
|
|||||||
if (quote.CustomerId.HasValue)
|
if (quote.CustomerId.HasValue)
|
||||||
{
|
{
|
||||||
// Existing customer
|
// Existing customer
|
||||||
if (!string.IsNullOrWhiteSpace(quote.CustomerCompanyName))
|
|
||||||
column.Item().Text(quote.CustomerCompanyName).FontSize(10).Bold();
|
|
||||||
|
|
||||||
var contactName = new List<string>();
|
var contactName = new List<string>();
|
||||||
if (!string.IsNullOrWhiteSpace(quote.CustomerContactFirstName)) contactName.Add(quote.CustomerContactFirstName);
|
if (!string.IsNullOrWhiteSpace(quote.CustomerContactFirstName)) contactName.Add(quote.CustomerContactFirstName);
|
||||||
if (!string.IsNullOrWhiteSpace(quote.CustomerContactLastName)) contactName.Add(quote.CustomerContactLastName);
|
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())
|
if (contactName.Any())
|
||||||
column.Item().Text(string.Join(" ", contactName)).FontSize(9);
|
column.Item().Text(contactFullName).FontSize(9);
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(quote.CustomerEmail))
|
if (!string.IsNullOrWhiteSpace(quote.CustomerEmail))
|
||||||
column.Item().Text(quote.CustomerEmail).FontSize(9);
|
column.Item().Text(quote.CustomerEmail).FontSize(9);
|
||||||
|
|||||||
Reference in New Issue
Block a user