- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_quote.php
- Класс: \CAllCrmQuote
- Вызов: CAllCrmQuote::HandleStorageElementDeletion
static function HandleStorageElementDeletion($storageTypeID, $elementID)
{
global $DB;
$storageTypeID = (int)$storageTypeID;
$elementID = (int)$elementID;
$dbResult = $DB->Query(
'SELECT QUOTE_ID FROM '.CCrmQuote::ELEMENT_TABLE_NAME.' WHERE STORAGE_TYPE_ID = '.$storageTypeID.' AND ELEMENT_ID = '.$elementID,
false,
'File: '.__FILE__.'
Line: '.__LINE__
);
while($arResult = $dbResult->Fetch())
{
$entityID = isset($arResult['QUOTE_ID']) ? (int)$arResult['QUOTE_ID'] : 0;
if($entityID <= 0)
{
continue;
}
$dbEntity = self::GetList(array(), array('ID' => $entityID), false, array('nTopCount' => 1), array('STORAGE_TYPE_ID', 'STORAGE_ELEMENT_IDS'));
$arEntity = $dbEntity->Fetch();
if(!is_array($arEntity))
{
continue;
}
$arEntity['STORAGE_TYPE_ID'] = isset($arEntity['STORAGE_TYPE_ID'])
? (int)$arEntity['STORAGE_TYPE_ID'] : $storageTypeID;
self::PrepareStorageElementIDs($arEntity);
if(!empty($arEntity['STORAGE_ELEMENT_IDS']))
{
$arEntity['STORAGE_ELEMENT_IDS'] = array_diff($arEntity['STORAGE_ELEMENT_IDS'], array($elementID));
}
$quote = new CCrmQuote(false);
$quote->Update($entityID, $arEntity, true, false);
}
}