Documentation

crm.currency.add

crm.currency.add(fields)

Creates and adds a new currency object.

Parameters

Parameter Description
fields An array in format array("field"=>"value"[, ...]) containing values of the currency fields, where "field" can have values from the returned by the crm.currency.fields method.

Attention! It is strongly recommended to define a set of localizations in the LANG field (see. crm.currency.localizations.set). If the LANG field is missing, then it is necessary to call crm.currency.localizations.set method for each active language. Otherwise, when returned, prices in this currency will use formatting settings by default.

Example

	BX24.callMethod(
	"crm.currency.add", 
	{
		fields:
		{ 
			"CURRENCY": "KWD",
			"AMOUNT_CNT": 1,
			"AMOUNT": 112.25,
			"SORT": 1000,
			"LANG": 		 
			{
				ru:
				{
					DEC_POINT:'.', 
					FORMAT_STRING:'# dinar', 
					FULL_NAME:'Kuwaiti dinar', 
					THOUSANDS_VARIANT:'C',
					DECIMALS: 2,
					HIDE_ZERO: "Y" //If decimal part is zero, it is removed when returned
				}, 
				en:
				{
					DEC_POINT:',', 
					FORMAT_STRING:'# KD', 
					FULL_NAME:'Kuwaiti Dinar', 
					THOUSANDS_VARIANT:'C',
					DECIMALS: 2,
					HIDE_ZERO: "Y"
				}
			}
		}
	}, 
	function(result) 
	{
		if(result.error())
			console.error(result.error());
		else
			console.info("Created currency with ID " + result.data());
	}
);	



© «Bitrix Inc.», 2001-2019, «Bitrix Inc.», 2019