CCrmExternalSaleImport::NotifyError

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmExternalSaleImport
  4. NotifyError
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_external_sale_import.php
  • Класс: \CCrmExternalSaleImport
  • Вызов: CCrmExternalSaleImport::NotifyError
private function NotifyError()
{
	if ($this->arExternalSale == null)
		$this->arExternalSale = CCrmExternalSale::GetDefaultSettings($this->externalSaleId);

	if (intval($this->arExternalSale["GROUP_ID"]) <= 0)
		return true;

	static $isSNIncluded = null;
	if ($isSNIncluded === null)
		$isSNIncluded = CModule::IncludeModule("socialnetwork");
	if (!$isSNIncluded)
		return;

	$ar = array(
		"#NAME#" => $this->arExternalSale["NAME"],
		"#URL#" => "/crm/configs/external_sale/",
		"#DATE#" => date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATETIME), time()),
	);
	$message = GetMessage("CRM_GCES_NOTIFY_ERROR_MESSAGE", $ar);

	$arFields = array(
		"EVENT_ID" => "crm_10_errors",
		"=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
		"TITLE_TEMPLATE" => "SYSTEM MESSAGE",
		"TITLE" => GetMessage("CRM_GCES_NOTIFY_ERROR_TITLE", array("#NAME#" => $this->arExternalSale["NAME"])),
		"MESSAGE" => $message,
		"TEXT_MESSAGE" => HTMLToTxt($message),
		"MODULE_ID" => "crm_shared",
		"CALLBACK_FUNC" => false,
		"SOURCE_ID" => false,
		"ENABLE_COMMENTS" => "Y",
		"ENTITY_TYPE" => SONET_ENTITY_GROUP,
		"ENTITY_ID" => $this->arExternalSale["GROUP_ID"],
		"URL" => "",
	);

	$logId = CSocNetLog::Add($arFields, false);

	if (intval($logId) > 0)
	{
		$arPerms = array(
			"SG".$this->arExternalSale["GROUP_ID"],
			"SG".$this->arExternalSale["GROUP_ID"]."_A",
			"SG".$this->arExternalSale["GROUP_ID"]."_E",
			"SG".$this->arExternalSale["GROUP_ID"]."_K"
		);

		CSocNetLog::Update($logId, array("TMP_ID" => $logId));
		CSocNetLogRights::Add($logId, $arPerms);
		CSocNetLog::SendEvent($logId, "SONET_NEW_EVENT", $logId);

		return $logId;
	}

	if (($ex = $GLOBALS["APPLICATION"]->GetException()) !== false)
		$this->AddError($ex->GetID(), $ex->GetString());
	else
		$this->AddError("CDA", "Notify error");

	return false;
}

Добавить комментарий