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.
Note: to find out the required field format, execute the method crm.currency.fields to view the retrieved field format.

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',С = comma, N = no separator, D = period, B = spacebar
					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());
	}
);	



© «Bitrix24», 2001-2024
Up