I am working on an extention that (should) add a cost field on some of our CIs classes. This would be a calculated field based on some values defined in another class, this class containing some 'brick level' cost. While it's not done, I do think that I should be able to that by following this great tutorial : https://www.itophub.io/wiki/page?id=3_0_0:customization:cascade-update
But I need to be sure that my 'brick level cost' are 'true numeric fields'. For now, I'm using a Decimal type. However, if I want to "localise the display" (for instance 1234.56 shoud be displayed "1,234.56" for an english reader and "1 234,56" for a french reader) I don't see how to do that.
Those localization parameters are mostly 'naturally' available in PHP (ok, that would be a 'server side' customization, not very useful in case of an international organization). I do suspect that this could also be possible in javascript (so inside the client browser) but this seems to be way over my (limited) coder level.
Do I miss something easy ? Searching trough the forum, I found references of the 'cost field' for the contrat, but I was a little "surprised" to see that the cost is actually stored as a string… Not the best start for a field used in computation…
So, any suggestion ?
By the way, should I decide to create a 'custom display' based on the User choosen Language in iTop, how can I get the User language ?
TIA,
Pascal
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It would be quite difficult indeed. So you actually have users with different language / decimals on one iTop instance? In the read-only value, you could perform some magic. In the frontend, you'd need to find some other trick I suppose; and also make sure iTop processes the data properly.
I remember something like Dict::GetUserLanguage() - you might want to check out that part. Then again, it depends if you want to make regional settings (decimal notation) dependent on language . Maybe you could add something on the user object, or the related person.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Actually no, we have users on diferrent timezones, but they are all french. So I can do a "crude work" and it will be OK. The question was more general, as if my extension is public, then it could be a problem for other users. But then again, I could imagine that the display format could be a parameter of the extension.
Thanks,
Pascal
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I am working on an extention that (should) add a cost field on some of our CIs classes. This would be a calculated field based on some values defined in another class, this class containing some 'brick level' cost. While it's not done, I do think that I should be able to that by following this great tutorial : https://www.itophub.io/wiki/page?id=3_0_0:customization:cascade-update
But I need to be sure that my 'brick level cost' are 'true numeric fields'. For now, I'm using a Decimal type. However, if I want to "localise the display" (for instance 1234.56 shoud be displayed "1,234.56" for an english reader and "1 234,56" for a french reader) I don't see how to do that.
Those localization parameters are mostly 'naturally' available in PHP (ok, that would be a 'server side' customization, not very useful in case of an international organization). I do suspect that this could also be possible in javascript (so inside the client browser) but this seems to be way over my (limited) coder level.
Do I miss something easy ? Searching trough the forum, I found references of the 'cost field' for the contrat, but I was a little "surprised" to see that the cost is actually stored as a string… Not the best start for a field used in computation…
So, any suggestion ?
By the way, should I decide to create a 'custom display' based on the User choosen Language in iTop, how can I get the User language ?
TIA,
Pascal
It would be quite difficult indeed. So you actually have users with different language / decimals on one iTop instance? In the read-only value, you could perform some magic. In the frontend, you'd need to find some other trick I suppose; and also make sure iTop processes the data properly.
I remember something like Dict::GetUserLanguage() - you might want to check out that part. Then again, it depends if you want to make regional settings (decimal notation) dependent on language . Maybe you could add something on the user object, or the related person.
Hi Jeffrey,
Actually no, we have users on diferrent timezones, but they are all french. So I can do a "crude work" and it will be OK. The question was more general, as if my extension is public, then it could be a problem for other users. But then again, I could imagine that the display format could be a parameter of the extension.
Thanks,
Pascal