corebos
corebos copied to clipboard
getprice hook does not support multicurrency
the current corebos.filter.inventory.getprice hook permits us to modify the price of a product/service when filling in the inventory product lines. It expects the current price and some other parameters to decide what the new price is.
We can return a modified unit price or a discount
When we are working in multicurrency and modify the unit price, the converted multicurrency price is not modified accordingly.
We must either add another hook to retrieve the modified price in the other currencies supported (which is in line with what the application does now) or dynamically calculate the converted price based on the new unit price.
This must be done here among other places:
https://github.com/tsolucio/corebos/blob/master/include/Webservices/CustomerPortalWS.php#L1032
after discussing a bit more: the correct solution is to add another hook. That hook can decide to return the price introduced in the UI, apply the current currency conversion to the new unit price or do any other logic that the new price in another currency may require.
corebos.filter.inventory.getprice.incurrency
will receive the new unitprice and the currency that we need it in along with all the context that getprice gets