- Модуль: lists
- Путь к файлу: ~/bitrix/modules/lists/lib/bizprocdocument.php
- Класс: BizprocDocument
- Вызов: BizprocDocument::UnlockDocument
static function UnlockDocument($documentId, $workflowId)
{
global $DB;
$strSql = "
SELECT * FROM b_iblock_element_lock
WHERE IBLOCK_ELEMENT_ID = ".intval($documentId)."
";
$query = $DB->query($strSql, false, "FILE: ".__FILE__."
LINE: ".__LINE__);
if($query->fetch())
{
$strSql = "
DELETE FROM b_iblock_element_lock
WHERE IBLOCK_ELEMENT_ID = ".intval($documentId)."
AND (LOCKED_BY = '".$DB->forSQL($workflowId, 32)."' OR '".$DB->forSQL($workflowId, 32)."' = '')
";
$query = $DB->query($strSql, false, "FILE: ".__FILE__."
LINE: ".__LINE__);
$result = $query->affectedRowsCount();
}
else
{//Success unlock when there is no locks at all
$result = 1;
}
if ($result > 0)
{
foreach (GetModuleEvents("iblock", "CIBlockDocument_OnUnlockDocument", true) as $event)
{
ExecuteModuleEventEx($event, array(array("lists", get_called_class(), $documentId)));
}
}
return $result > 0;
}