HOWTO Add and delete currencies in DATABASE


To DELETE currency, in AtomiaBilling database, there is a table reseller_currencies. It holds references towards other tables, so just plain look at it will not tell you currently available currencies per reseller, but here is query that you can use:


SELECT a.name, c.name, 'delete from AtomiaBilling..reseller_currencies

WHERE fk_reseller_configuration_id = ''' + CONVERT(nvarchar(max), rc.fk_reseller_configuration_id) + ''' and fk_currency_id = ''' + CONVERT(nvarchar(max), rc.fk_currency_id) + ''''

FROM AtomiaBilling..reseller_currencies rc

INNER JOIN AtomiaBilling..account_details d on d.fk_reseller_configuration_id = rc.fk_reseller_configuration_id

INNER JOIN AtomiaAccount..account a on a.id = d.account_id

INNER JOIN AtomiaBilling..currency c on c.id = rc.fk_currency_id

ORDER BY a.name, c.name



Basically, to disable some currency for particular reseller, you need to remove a record from AtomiaBilling..reseller_currencies, one that references unwanted currency for an account where it is not wanted. In above query there is a column that will give you delete query as a result (for particular reseller and currency).


Just make sure to use transactions for safety measures.



To ADD currency, this is basically reverse thing. So insert a record that holds ID of wanted currency and ID of reseller's configuration.


To get ID of wanted currency, check AtomiaBilling..currency table.

In order to  get reseller's configuration_id , first, get account's_id from AtomiaAccount..account (you will need to know reseller's account number), then use this ID in AtomiaBilling..account_details table to locate reseller’s configuration id.




For more information you can always contact Atomia’s friendly support team.