- Модуль: iblock
- Путь к файлу: ~/bitrix/modules/iblock/lib/bizproctype/money.php
- Класс: BitrixIblockBizprocTypeMoney
- Вызов: Money::cloneTypeControlMoney
function cloneTypeControlMoney(tableID, wrapperId, separator, listCurrency)
{
var tbl = document.getElementById(tableID);
var cnt = tbl.rows.length;
var oRow = tbl.insertRow(cnt);
var oCell = oRow.insertCell(0);
var sHTML = tbl.rows[cnt - 1].cells[0].innerHTML;
var p = 0, s, e, n;
while (true)
{
s = sHTML.indexOf('[n', p);
if (s < 0)
break;
e = sHTML.indexOf(']', s);
if (e < 0)
break;
n = parseInt(sHTML.substr(s + 2, e - s));
sHTML = sHTML.substr(0, s) + '[n' + (++n) + ']' + sHTML.substr(e + 1);
p = s + 1;
}
var regExp = new RegExp('data-id=".+?"', 'g'), oldId, newId = BX.util.getRandomString(6).toLowerCase();
var match = sHTML.match(regExp);
if(match) match = match[0].match(/"([^"]*)"/i);
if(match) oldId = match[1];
sHTML = sHTML.replace(new RegExp(oldId, 'g'), newId);
oCell.innerHTML = sHTML;
if(BX.HandlerMoneyField) {
var handlerMoneyField = new BX.HandlerMoneyField({
randomString: newId,
defaultSeparator: separator,
listCurrency: listCurrency
});
}
}