From b1f535a0409de6e6dec96619f3d9180b686e3a70 Mon Sep 17 00:00:00 2001 From: Marcus Gesing Date: Wed, 11 Nov 2020 12:13:32 +0100 Subject: [PATCH] Fixes export profile never updated. MiniMapper too dangerous here: DbEntityValidationException: Validation failed for one or more entities. See 'EntityValidationErrors' property for more details. InvalidOperationException: The relationship could not be changed because one or more of the foreign-key properties is non-nullable. --- .../Administration/Controllers/ExportController.cs | 13 +++++++++++-- .../Administration/Views/Export/Edit.cshtml | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Presentation/SmartStore.Web/Administration/Controllers/ExportController.cs b/src/Presentation/SmartStore.Web/Administration/Controllers/ExportController.cs index 9152d25254..0f59008923 100644 --- a/src/Presentation/SmartStore.Web/Administration/Controllers/ExportController.cs +++ b/src/Presentation/SmartStore.Web/Administration/Controllers/ExportController.cs @@ -755,12 +755,19 @@ public ActionResult Edit(ExportProfileModel model, bool continueEditing) return View(model); } - MiniMapper.Map(profile, model); - + profile.Name = model.Name; + profile.FileNamePattern = model.FileNamePattern; + profile.FolderName = model.FolderName; + profile.Enabled = model.Enabled; + profile.ExportRelatedData = model.ExportRelatedData; + profile.Offset = model.Offset; profile.Limit = model.Limit ?? 0; profile.BatchSize = model.BatchSize ?? 0; + profile.PerStore = model.PerStore; profile.CompletedEmailAddresses = string.Join(",", model.CompletedEmailAddresses ?? new string[0]); profile.EmailAccountId = model.EmailAccountId ?? 0; + profile.CreateZipArchive = model.CreateZipArchive; + profile.Cleanup = model.Cleanup; if (profile.Name.IsEmpty()) profile.Name = provider.Metadata.FriendlyName; @@ -779,6 +786,7 @@ public ActionResult Edit(ExportProfileModel model, bool continueEditing) projection.AppendDescriptionText = string.Join(",", model.Projection.AppendDescriptionText ?? new string[0]); projection.RemoveCriticalCharacters = model.Projection.RemoveCriticalCharacters; projection.CriticalCharacters = string.Join(",", model.Projection.CriticalCharacters ?? new string[0]); + profile.Projection = XmlHelper.Serialize(projection); } @@ -791,6 +799,7 @@ public ActionResult Edit(ExportProfileModel model, bool continueEditing) filter.StoreId = model.Filter.StoreId ?? 0; filter.CategoryIds = model.Filter.CategoryIds?.Where(x => x != 0)?.ToArray() ?? new int[0]; + profile.Filtering = XmlHelper.Serialize(filter); } diff --git a/src/Presentation/SmartStore.Web/Administration/Views/Export/Edit.cshtml b/src/Presentation/SmartStore.Web/Administration/Views/Export/Edit.cshtml index ad8b7c96ec..a7762a8e1e 100644 --- a/src/Presentation/SmartStore.Web/Administration/Views/Export/Edit.cshtml +++ b/src/Presentation/SmartStore.Web/Administration/Views/Export/Edit.cshtml @@ -11,6 +11,7 @@
@Html.AntiForgeryToken() @Html.HiddenFor(model => model.Id) + @Html.HiddenFor(model => model.ProviderSystemName)