- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/tradingplatform/vk/map.php
- Класс: BitrixSaleTradingPlatformVkMap
- Вызов: Map::removeEntityMapping
static function removeEntityMapping($values, $mapEntityID, $flagKey = '')
{
$result = true;
// todo: maybe we can use packed adding for acceleration
foreach ($values as $item)
{
// break empty items
if(empty($item))
continue;
// preserve lowercase $item
$item = array_change_key_case($item, CASE_UPPER);
if ($flagKey == "ONLY_INTERNAL")
unset($item["VALUE_EXTERNAL"]);
elseif ($flagKey == "ONLY_EXTERNAL")
unset($item["VALUE_INTERNAL"]);
$fields = array("ENTITY_ID" => $mapEntityID);
$fields = array_merge($fields, $item);
$id = MapTable::getList(array(
"filter" => $fields,
"select" => array("ID"),
)
);
$id = $id->fetch();
if ($id)
{
$delRes = MapTable::delete($id["ID"]);
if (!$delRes->isSuccess() || !$result)
$result = false;
}
else
$result = false;
}
// if result == false - we have problem minimum in one item, maybe in all items
return $result;
}