Remove hard-coded 'Contact' member type to type taken from the real member object
tatarincev opened this issue · 7 comments
https://github.com/VirtoCommerce/vc-module-order/blob/master/VirtoCommerce.OrderModule.Web/Scripts/blades/customerOrder-detail.js#L37
Need to load member object first and use it real type for view resolving
Nothing has changed. There is still hardcoded member type 'Contact':
https://github.com/VirtoCommerce/vc-module-order/blob/master/VirtoCommerce.OrderModule.Web/Scripts/blades/customerOrder-detail.js#L57
@artem-dudarev As you can see, it was hardcoded type 'Contact' for all members in line 37.
Now, if we have real member with given id - Contact, Organization, etc. for the order owner - we use its type. It is the case where we could get and removed hardcoded type.
Otherwise (means there is no corresponding member, so there is no possibility to get memberType from member) - we are using default 'Contact' type and get user from security accounts API.
The problem is that you never load the real member. Order.CustomerId is a UserId and members.get({ id: blade.customerOrder.customerId }
on line 53 will never find any member.
You should load an account, like on line 55, and AFTER that load a member by account.memberId.