moqui / mantle-usl

Mantle Universal Service Library
http://www.moqui.org/mantle.html
Other
30 stars 61 forks source link

Fix incorrect read of vendorPartyId and customerPartyId for add#OrderProductQuantity #153

Closed dixitdeepak closed 4 years ago

dixitdeepak commented 4 years ago

customerPartyId set from orderPart.customerPartyId and not found set the current user party id. Same pattern in case of vendorPartyId, set it from orderPart.vendorPartyId if not found set it from productStore?.organizationPartyId.

But at some places we are reading them form orderPart itself, this give some time can not read property on null object.

jonesde commented 4 years ago

Thanks for submitting this. It looks like the issue is that when an existing open order is used the orderHeader and orderPart entity value objects were not looked up. Please see commit 84457df where this is fixed, it address the issue you described.

Using vendorPartyId and customerPartyId directly rather than from orderPart would be fine if they were populated if needed from orderPart, otherwise from just your patch it would only work if they were both always passed to the service. There would also be risk of odd behavior if a different vendorPartyId and/or customerPartyId were passed to the service than were set on the OrderPart.

There may be more needed here to better validate, etc.