Skip to content

Commit

Permalink
Resolves #1766 Customer FullName is not populated after registration
Browse files Browse the repository at this point in the history
  • Loading branch information
mgesing committed Dec 16, 2019
1 parent 14eba08 commit 153949e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
* Fixed InvalidOperationException in CreatePdfInvoiceAttachment when an order is placed by a guest.
* The ShowDescriptionInSubPages setting should also be applied to the bottom category description.
* #1774 Recaptcha: doesn't work for product reviews, blog and news comments if hidden captcha is activated.
* #1766 Customer FullName is not populated after registration.


## SmartStore.NET 3.2.2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Generic;
using Autofac;
using SmartStore.Core.Data;
using SmartStore.Core.Data.Hooks;
using SmartStore.Core.Domain.Customers;

namespace SmartStore.Services.Hooks
{
[Important]
[Important]
public class UpdateCustomerFullNameHook : DbSaveHook<Customer>
{
private static readonly HashSet<string> _candidateProps = new HashSet<string>(new string[]
Expand Down Expand Up @@ -40,13 +39,18 @@ private void UpdateFullName(Customer entity, IHookedEntity entry)
{
var shouldUpdate = entity.IsTransientRecord();

if (!entity.IsTransientRecord())
if (!shouldUpdate)
{
shouldUpdate = entity.FullName.IsEmpty() && (entity.FirstName.HasValue() || entity.LastName.HasValue());
}

if (!shouldUpdate)
{
var modProps = _ctx.Resolve<IDbContext>().GetModifiedProperties(entity);
shouldUpdate = _candidateProps.Any(x => modProps.ContainsKey(x));
}

if (shouldUpdate)
if (shouldUpdate)
{
var parts = new[]
{
Expand Down

0 comments on commit 153949e

Please sign in to comment.