adding a new iso code for a currency
Submitted by larsrikart on Sat, 05/03/2011 - 17:43
Hi
When I try to add a new currency in lookups I only get to choose between 5 different ISO Codes(from existing currencies?) and I believe I shoiuld be able to add my own ISO Code.
How is that done?
Lars
Re: adding a new iso code for a currency
You need to change the lookup.currency archetype.
At present, the only way to do this is by editing:
<OPENVPMS_HOME>/update/archetypes/org/openvpms/archetype/lookup/lookup.currency.adl
and changing the code node to add your new code:
<node displayName="ISO code" name="code" path="/code"
type="java.lang.String" minCardinality="1" maxLength="3">
<assertion name="lookup.local">
<propertyList name="entries">
<property name="AUD" value="AUD"/>
<property name="NZD" value="NZD"/>
<property name="USD" value="USD"/>
<property name="EUR" value="EUR"/>
<property name="CAD" value="CAD"/>
<property name="GBP" value="GBP"/>
<property name="GBP" value="GBP"/>
<property name="<NEW_CODE>" value="<NEW_CODE>"/>
</propertyList>
<errorMessage>Invalid ISO Code</errorMessage>
</assertion>
</node>
You can then reload the archetypes with the archload.bat/.sh script in <OPENVPMS_HOME>/bin
You'll need to restart the webapp for it to get the updated archetype.
Once loaded, you can create a new currency lookup with the appropriate ISO code in the Administration -> Lookups workspace.
What currency do you want added, so I can make sure it goes into the next release?
Re: adding a new iso code for a currency
Hi Lars,
You can create the new ISO code as per the above information Tim provided but the easiest way to update the application is to import the new archetype in Administration->Archetypes. This will update the existing and not require a Tomcat restart.
Cheers
Tony
Re: adding a new iso code for a currency
Please add ISO Code DKK for Danish Krone
Re: adding a new iso code for a currency
Done. The change will be available in the 1.6 release.
-Tim
Re: adding a new iso code for a currency - HKD & CNY
I am doing an implementation for Hong Kong and need HKD and CNY (Chinese Yuan Renminbi).
I have added them using the above recipe, but would appreciate it if these are added to the 1.6 release if there is still time.
Note that I see no downside in loading the complete ISO 4217 list. One could argue that OpenVPMS is unlikely to be used in say Argentina (ARS) because of the language problem, but it could be used in any country where English is an operation language - like South Africa (ZAR).
Re: adding a new iso code for a currency - HKD & CNY
It's not that hard to do a more or less complete localization. Have done this for Danish.
Lars
Re: adding a new iso code for a currency - HKD & CNY
Would you like to contribute your changes back to the project?
Regards,
Tim
Re: adding a new iso code for a currency - HKD & CNY
I've added the ISO currencies to lookup.currency for 1.6.
You will still need to create the corresponding lookup.currency instances for the currencies you want to support.
-Tim