From 437b68d77c6fa60099db5846fcac46093220246b Mon Sep 17 00:00:00 2001 From: KrzysztofPajak Date: Mon, 20 Apr 2020 15:10:35 +0200 Subject: [PATCH] Minor changes --- .../Installation/CodeFirstInstallationService.cs | 2 +- .../Messages/DotLiquidDrops/LiquidOrderItem.cs | 15 ++++++--------- Grand.Services/Messages/MessageTokenProvider.cs | 2 +- Grand.Services/Orders/OrderProcessingService.cs | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Grand.Services/Installation/CodeFirstInstallationService.cs b/Grand.Services/Installation/CodeFirstInstallationService.cs index e9a20eb8cc..7e9d4ceceb 100644 --- a/Grand.Services/Installation/CodeFirstInstallationService.cs +++ b/Grand.Services/Installation/CodeFirstInstallationService.cs @@ -4389,7 +4389,7 @@ protected virtual async Task InstallMessageTemplates() Name = "OrderCancelled.VendorNotification", Subject = "{{Store.Name}}. Order #{{Order.OrderNumber}} cancelled", Body = "

{{Store.Name}}

Order #{{Order.OrderNumber}} has been cancelled.

Order Number: {{Order.OrderNumber}}
Date Ordered: {{Order.CreatedOn}}

", - IsActive = true, + IsActive = false, EmailAccountId = eaGeneral.Id, }, new MessageTemplate diff --git a/Grand.Services/Messages/DotLiquidDrops/LiquidOrderItem.cs b/Grand.Services/Messages/DotLiquidDrops/LiquidOrderItem.cs index 597ac23d66..c1b26c5413 100644 --- a/Grand.Services/Messages/DotLiquidDrops/LiquidOrderItem.cs +++ b/Grand.Services/Messages/DotLiquidDrops/LiquidOrderItem.cs @@ -18,19 +18,17 @@ public partial class LiquidOrderItem : Drop private Order _order; private Product _product; private Language _language; - private Currency _currency; private Store _store; private Vendor _vendor; public LiquidOrderItem(OrderItem orderItem, Product product, Order order, Language language, Currency currency, Store store, Vendor vendor) { - this._orderItem = orderItem; - this._store = store; - this._language = language; - this._currency = currency; - this._order = order; - this._product = product; - this._vendor = vendor; + _orderItem = orderItem; + _store = store; + _language = language; + _order = order; + _product = product; + _vendor = vendor; AdditionalTokens = new Dictionary(); } @@ -62,7 +60,6 @@ public string LicenseUrl { get { - var storeId = _order?.StoreId; string licenseUrl = string.Format("{0}download/getlicense/{1}", (_store.SslEnabled ? _store.SecureUrl : _store.Url), _orderItem.OrderItemGuid); return licenseUrl; } diff --git a/Grand.Services/Messages/MessageTokenProvider.cs b/Grand.Services/Messages/MessageTokenProvider.cs index 84510eb2e9..d01c9eb416 100644 --- a/Grand.Services/Messages/MessageTokenProvider.cs +++ b/Grand.Services/Messages/MessageTokenProvider.cs @@ -188,7 +188,7 @@ public async Task AddOrderTokens(LiquidObject liquidObject, Order order, Custome foreach (var item in order.OrderItems.Where(x => x.VendorId == vendor?.Id || vendor == null)) { var product = await productService.GetProductById(item.ProductId); - var vendorItem = await vendorService.GetVendorById(item.VendorId); + Vendor vendorItem = string.IsNullOrEmpty(item.VendorId) ? null : await vendorService.GetVendorById(item.VendorId); var liqitem = new LiquidOrderItem(item, product, order, language, currency, store, vendorItem); #region Download diff --git a/Grand.Services/Orders/OrderProcessingService.cs b/Grand.Services/Orders/OrderProcessingService.cs index 1f41e827dd..e55af8fd8a 100644 --- a/Grand.Services/Orders/OrderProcessingService.cs +++ b/Grand.Services/Orders/OrderProcessingService.cs @@ -1186,7 +1186,7 @@ protected virtual async Task> GetVendorsInOrder(Order order) { //find existing var vendor = vendors.FirstOrDefault(v => v.Id == orderItem.VendorId); - if (vendor == null) + if (vendor == null && !string.IsNullOrEmpty(orderItem.VendorId)) { //not found. load by Id vendor = await _vendorService.GetVendorById(orderItem.VendorId);