Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with webservice methods and inventory modules
#11
So basically before invoking the webservice methods always run 'CurrencyField::convertToUserFormat()' on any currency field you want to save?
Reply
#12
If you are calling from inside the application: yes,
If you are creating your own external application it will/should have it's own mechanisms to format the numbers for the user depending on his settings there.
Joe
TSolucio
Reply
#13
Great, thanks!

One thing though: I remember the workflow I had this problem with. It updated the salesorder status and duedate, and left the rest alone. How should I input the user's currency prefs if I'm not updating any fields that are in currency format?
Reply
#14
I'd say, leave them empty and use Revise
test it
Joe
TSolucio
Reply
#15
Will do
Reply
#16
I can confirm this works as you said. I need to convert the amounts to the user's format before sending them in. This does mean that when I want to only update a salesorder status, I have to retrieve the amounts, save them somewhere, convert them to the user's format and send them back in, even though I didn't want to change them at all. Is there any way we could get the user's currency format from the webservice API? I've now hardcoded this, but this makes it not-so-flexible.

This means another thing as well: my portal users don't have access to the amount fields. I have to grant them this permission (even though I store the amounts out of sight) to retrieve them, so I can send them back in the correct format.

EDIT
I remember now we can use revise. Let me see how to implement this in the client. Could I do this through the Invoke?
Reply
#17
You can use invoke and also the latest version of the PHP library:

https://github.com/tsolucio/coreBOSwsLibrary/blob/master/php/WSClient.php#L256

Let me know how it goes
Joe
TSolucio
Reply
#18
Thanks again. Will work on this.

Just did a test invoking the revise method from my portal, only sending the updated status and the ID. The status update worked, but the total and subtotal are still multiplied by a million. I really need to retrieve the currency fields, reset them to user format before sending in and send them in either the update or revise to prevent this from happening. Even the revise method does not leave the total fields alone.
Reply
#19
I remember testing this use case. I will test it again and get back to you.
Joe
TSolucio
Reply
#20
I think I got this one:

https://github.com/tsolucio/corebos/commit/567d15b9a52b9a485d99c0ff2a3c73e834ac7c0e

sorry for taking so long

please try it when you can and let me know how it goes.
Joe
TSolucio
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)