Hello world.
We have an issue that is causing havoc in our integrations to other systems at the moment. Our line item ids change on our PurchaseOrders in certain processes!
In our solution we use the LineItemId as an identifier that we send to other systems. If any of us update a line item for some reason we use a LineItemId to reference the specific one that should get the updates on the other end of the integration. So it's pretty bad if the LineItemIds keep changing on us.
After noticing this issue I've narrowed it down to the way that the promotion engine filters out items that shouldn't be considered for promotions for whatever reason we specify in our filtering.
I've writtein up some code to replicate the issue. The IEntryFilter that the IoC uses can look like this:
public class MyEntryFilter : IEntryFilter
{
public IEnumerable Filter(IEnumerable entryCodes)
{
return Enumerable.Empty();
}
}
(Basicly filter out everything)
We can then run this code to test the filter:
public void TestPromotionEngineFilter(int orderGroupId)
{
var orderRepo = ServiceLocator.Current.GetInstance();
var entryFilter = ServiceLocator.Current.GetInstance();
var order = orderRepo.Load(orderGroupId);
var filterHandler = new EntryFilterHandler(entryFilter, order.Forms.First());
filterHandler.ExcludeItems();
filterHandler.RestoreItems();
orderRepo.Save(order);
}
After running this the lineitemIds will have changed on all items on that order.
This seems to have to do with the way that EntryFilterHandlerdeals with filtering. It first removes the items from the Shipment in ExcludeItems() (this also triggers code that removes it from the OrderForm), then when the promotion engine has finished running it adds them back to the Shipment with RestoreItems().
So to my question:
Has anyone else encountered this issue? Is there a quick (and dirty is acceptable too at the moment) solution out there already maybe? (beyond removing our code that filters out items we don't want to be considered for promotions, I'm already considering the implications of doing that.)
Version:
10.6.0
(But the latest version handles the filtering in the same manner)