Ejemplo n.º 1
0
 /**
  * Метод клонирует документ.
  *
  * @param string $documentId - ID документа.
  * @param string $arFields - поля для замены.
  */
 public function CloneElement($ID, $arFields = array(), $arParams = array())
 {
     global $DB;
     $ID = intval($ID);
     $CHILD_ID = parent::CloneElement($ID, $arFields);
     if ($CHILD_ID > 0) {
         $db_res = CIBlockElement::GetList(array(), array("ID" => $ID, "SHOW_NEW" => "Y", "SHOW_HISTORY" => "Y"), false, false, array("IBLOCK_ID", "ID", "NAME"));
         $arParent = $db_res->Fetch();
         CBPDocument::AddDocumentToHistory(array("webdav", "CIBlockDocumentWebdavSocnet", $CHILD_ID), str_replace(array("#ID#", "#NAME#", "#PARENT_ID#", "#PARENT_NAME#"), array($CHILD_ID, $arFields["NAME"], $ID, $arParent["NAME"]), GetMessage("IBD_TEXT_002")), $GLOBALS["USER"]->GetID());
     }
     return $CHILD_ID;
 }