public function OnAfterIBlockElementDelete($fields) { $errors = array(); if (Loader::includeModule('socialnetwork')) { $states = CBPStateService::getDocumentStates(array('lists', get_called_class(), $fields['ID'])); foreach ($states as $workflowId => $state) { $sourceId = CBPStateService::getWorkflowIntegerId($workflowId); $resultQuery = CSocNetLog::getList(array(), array('EVENT_ID' => 'lists_new_element', 'SOURCE_ID' => $sourceId), false, false, array('ID')); while ($log = $resultQuery->fetch()) { CSocNetLog::delete($log['ID']); } } } CBPDocument::onDocumentDelete(array('lists', get_called_class(), $fields['ID']), $errors); }
public static function deleteWorkflowsFile($fileId) { $documentData = array('DISK' => \Bitrix\Disk\BizProcDocument::getDocumentComplexId($fileId), 'WEBDAV' => \Bitrix\Disk\BizProcDocumentCompatible::getDocumentComplexId($fileId)); $errors = array(); foreach ($documentData as $nameModule => $data) { \CBPDocument::onDocumentDelete($data, $errors); } }
public function OnAfterIBlockElementDelete($fields) { if (CModule::includeModule('bizproc')) { $errors = array(); $iblockType = COption::getOptionString("lists", "livefeed_iblock_type_id"); $iblockQuery = CIBlock::getList(array(), array('ID' => $fields['IBLOCK_ID'])); if ($iblock = $iblockQuery->fetch()) { $iblockType = $iblock["IBLOCK_TYPE_ID"]; } $states = CBPStateService::getDocumentStates(BizprocDocument::getDocumentComplexId($iblockType, $fields['ID'])); $listWorkflowId = array(); foreach ($states as $workflowId => $state) { $listWorkflowId[] = $workflowId; } self::deleteSocnetLog($listWorkflowId); CBPDocument::onDocumentDelete(BizprocDocument::getDocumentComplexId($iblockType, $fields['ID']), $errors); } $propertyQuery = CIBlockElement::getProperty($fields['IBLOCK_ID'], $fields['ID'], 'sort', 'asc', array('ACTIVE' => 'Y')); while ($property = $propertyQuery->fetch()) { $userType = \CIBlockProperty::getUserType($property['USER_TYPE']); if (array_key_exists('DeleteAllAttachedFiles', $userType)) { call_user_func_array($userType['DeleteAllAttachedFiles'], array($fields['ID'])); } } }