Skip to content

Commit

Permalink
Merge branch 'release/3.417.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
vc-ci committed Oct 26, 2023
2 parents eb21b08 + c3efea5 commit f3af99e
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<!-- These properties will be shared for all projects -->
<PropertyGroup>
<VersionPrefix>3.416.0</VersionPrefix>
<VersionPrefix>3.417.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<VersionSuffix Condition=" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,21 +406,26 @@ public async Task<ActionResult> UpdateOrder([FromBody] CustomerOrder customerOrd
public async Task<ActionResult<Shipment>> GetNewShipment(string id)
{
var order = await _customerOrderService.GetNoCloneAsync(id, CustomerOrderResponseGroup.Full.ToString());
if (order != null)
if (order == null)
{
var retVal = AbstractTypeFactory<Shipment>.TryCreateInstance();
retVal.Id = Guid.NewGuid().ToString();
retVal.Currency = order.Currency;
retVal.Status = "New";

var store = await _storeService.GetNoCloneAsync(order.StoreId, StoreResponseGroup.StoreInfo.ToString());
var numberTemplate = store.Settings.GetValue<string>(ModuleConstants.Settings.General.OrderShipmentNewNumberTemplate);
retVal.Number = _uniqueNumberGenerator.GenerateNumber(numberTemplate.ToString());
return NotFound();
}

return Ok(retVal);
var store = await _storeService.GetNoCloneAsync(order.StoreId, StoreResponseGroup.StoreInfo.ToString());
if (store == null)
{
return BadRequest(GetNoStoreErrorMessage(order));
}

return NotFound();
var retVal = AbstractTypeFactory<Shipment>.TryCreateInstance();
retVal.Id = Guid.NewGuid().ToString();
retVal.Currency = order.Currency;
retVal.Status = "New";

var numberTemplate = store.Settings.GetValue<string>(ModuleConstants.Settings.General.OrderShipmentNewNumberTemplate);
retVal.Number = _uniqueNumberGenerator.GenerateNumber(numberTemplate.ToString());

return Ok(retVal);
}

/// <summary>
Expand All @@ -433,23 +438,29 @@ public async Task<ActionResult<Shipment>> GetNewShipment(string id)
public async Task<ActionResult<PaymentIn>> GetNewPayment(string id)
{
var order = await _customerOrderService.GetNoCloneAsync(id, CustomerOrderResponseGroup.Full.ToString());
if (order != null)
if (order == null)
{
var retVal = AbstractTypeFactory<PaymentIn>.TryCreateInstance();
retVal.Id = Guid.NewGuid().ToString();
retVal.Currency = order.Currency;
retVal.CustomerId = order.CustomerId;
retVal.Status = retVal.PaymentStatus.ToString();
return NotFound();
}

var store = await _storeService.GetNoCloneAsync(order.StoreId, StoreResponseGroup.StoreInfo.ToString());
var numberTemplate = store.Settings.GetValue<string>(ModuleConstants.Settings.General.OrderPaymentInNewNumberTemplate);
retVal.Number = _uniqueNumberGenerator.GenerateNumber(numberTemplate.ToString());
return Ok(retVal);
var store = await _storeService.GetNoCloneAsync(order.StoreId, StoreResponseGroup.StoreInfo.ToString());
if (store == null)
{
return BadRequest(GetNoStoreErrorMessage(order));
}

return NotFound();
var retVal = AbstractTypeFactory<PaymentIn>.TryCreateInstance();
retVal.Id = Guid.NewGuid().ToString();
retVal.Currency = order.Currency;
retVal.CustomerId = order.CustomerId;
retVal.Status = retVal.PaymentStatus.ToString();

var numberTemplate = store.Settings.GetValue<string>(ModuleConstants.Settings.General.OrderPaymentInNewNumberTemplate);
retVal.Number = _uniqueNumberGenerator.GenerateNumber(numberTemplate.ToString());
return Ok(retVal);
}


/// <summary>
/// Delete a whole customer orders
/// </summary>
Expand Down Expand Up @@ -741,5 +752,10 @@ private async Task<ValidationResult> ValidateAsync(CustomerOrder customerOrder)

return new ValidationResult();
}

private static string GetNoStoreErrorMessage(CustomerOrder order)
{
return $"Store {order.StoreId} does not exist in the system. Please create {order.StoreId} store or select another store for the order.";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ angular.module('virtoCommerce.orderModule')
foundField.isReadOnly = false;
}

customerOrders.getNewPayment({ id: blade.customerOrder.id }, blade.initialize);
customerOrders.getNewPayment({ id: blade.customerOrder.id }, blade.initialize, function (error) {
blade.isLocked = true;
bladeNavigationService.setError(error.data, blade);
});
} else {
blade.isLocked = !blade.currentEntity || (blade.currentEntity.status === 'Paid'
|| blade.currentEntity.cancelledState === 'Requested'
Expand Down Expand Up @@ -127,6 +130,10 @@ angular.module('virtoCommerce.orderModule')
}

blade.fetchVendors = function (criteria) {
if (blade.isLocked) {
return [];
}

return members.search(criteria);
}

Expand Down Expand Up @@ -154,7 +161,7 @@ angular.module('virtoCommerce.orderModule')
blade.customInitialize = function () {
if (!blade.currentEntity) {
return;
}
}
blade.isLocked = blade.currentEntity.status === 'Paid' || blade.currentEntity.cancelledState === 'Completed' || blade.currentEntity.isCancelled;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ angular.module('virtoCommerce.orderModule')
foundField.isReadOnly = false;
}

customerOrders.getNewShipment({ id: blade.customerOrder.id }, blade.initialize);
customerOrders.getNewShipment({ id: blade.customerOrder.id }, blade.initialize, function (error) {
blade.isLocked = true;
bladeNavigationService.setError(error.data, blade);
});
} else {
blade.isLocked = !blade.currentEntity || blade.currentEntity.status === 'Send'
|| blade.currentEntity.cancelledState === 'Completed'
Expand Down Expand Up @@ -62,6 +65,10 @@ angular.module('virtoCommerce.orderModule')
}

blade.fetchEmployees = function (criteria) {
if (blade.isLocked) {
return [];
}

criteria.memberType = 'Employee';
criteria.deepSearch = true;
criteria.sort = 'name';
Expand All @@ -84,6 +91,10 @@ angular.module('virtoCommerce.orderModule')
}

blade.fetchVendors = function (criteria) {
if (blade.isLocked) {
return [];
}

return members.search(criteria);
}

Expand Down
2 changes: 1 addition & 1 deletion src/VirtoCommerce.OrdersModule.Web/module.manifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<module>
<id>VirtoCommerce.Orders</id>
<version>3.416.0</version>
<version>3.417.0</version>
<version-tag />
<platformVersion>3.413.0</platformVersion>
<dependencies>
Expand Down

0 comments on commit f3af99e

Please sign in to comment.