В структуре компании должен быть только один раздел верхнего уровня.
[Error]
Call to a member function Fetch() on bool (0)
/var/www/html/bx-site/1c_exchange/import_sections.php:99
while($ar = $res->Fetch()){
/* todo или всегда полная выгрузка?
* Пометка на удаление? - находим и удаляем
*/
$bs = new CIBlockSection;
/*
* сбор информации по подразделению
*/
$head_id = 0;
if(strlen($ar["HEAD"])>0){
$filter = Array("LOGIN_EQUAL"=> $ar["HEAD"]);
$reshead = CUser::GetList(($by="id"), ($order="desc"), $filter, array("SELECT"=>array("UF_*"), "FIELDS"=>array("ID","LOGIN")));
while($arhead = $reshead->fetch()){
if($arhead["LOGIN"]==$ar["HEAD"])
$head_id = $arhead["ID"];
}
}
$arFields = Array(
"ACTIVE" => "Y",
"XML_ID" => $ar["XML_ID"],
"CODE" => $ar["INDEX"],
"IBLOCK_ID" => 3,
"NAME" => $ar["NAME"],
);
if($head_id>0) {
$arFields["UF_HEAD"] = (int)$head_id;
}else{
$arFields["UF_HEAD"] = '';
}
if($ar["DEPTH_LEVEL"]>0){
$arFields["IBLOCK_SECTION_ID"] = CIBlockSection::GetList(array(), array("IBLOCK_ID"=>IBLOCK_DEPS,"XML_ID"=>$ar["PARENT_SECTION"]), false, array("ID"))->Fetch()["ID"];
if(is_null($arFields["IBLOCK_SECTION_ID"])) continue;
}
$XML_ID_UPDATE[] = $ar["XML_ID"];
$resSectionFind = CIBlockSection::GetList(Array(), array("IBLOCK_ID"=>3,"XML_ID"=>$ar["XML_ID"]), Array("nPageSize"=>1), array("ID"));
if($arSectionFind = $resSectionFind->Fetch()){
//обновляем
$bs->Update($arSectionFind["ID"], $arFields);
$updated++;
}else{
//создаем
$bs->Add($arFields);
$added++;
}
}
if(is_null($arFields["IBLOCK_SECTION_ID"])) continue;
$res = CIBlockElement::GetList( false, $arFilter, array( 'IBLOCK_ID', 'ID', 'PROPERTY_902', 'IBLOCK_SECTION_ID' ) );
// Перебираем все элементы инфоблока и записываем в массив их IDшники
while ( $el = $res->GetNext() ):
//echo $arElementsID[] = $el['ID'];
//print_r( $el );
$PROP = array();
$PROP[902] = $el['IBLOCK_SECTION_ID'];
$ELEMENT_ID = $el['ID'];
CIBlockElement::SetPropertyValuesEx($ELEMENT_ID, false, array("PROPERTY_VALUES" => $PROP));
endwhile;
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
/**
* Bitrix vars
*
* @var array $arParams
* @var array $arResult
* @var CBitrixComponent $this
* @global CMain $APPLICATION
* @global CUser $USER
*/
if(!is_array($arParams["~AUTH_RESULT"]) && $arParams["~AUTH_RESULT"] <> '')
{
$arParams["~AUTH_RESULT"] = array("MESSAGE" => $arParams["~AUTH_RESULT"], "TYPE" => "ERROR");
}
$arResult["SHOW_FORM"] = !(is_array($arParams["~AUTH_RESULT"]) && $arParams["~AUTH_RESULT"]["TYPE"] == "OK");
$arResult["USE_PASSWORD"] = false;
if(is_array($arParams["~AUTH_RESULT"]) && $arParams["~AUTH_RESULT"]["TYPE"] == "ERROR" && $arParams["~AUTH_RESULT"]["ERROR_TYPE"] == "CHANGE_PASSWORD")
{
//it's required to change the password after N days, use password instead of checkword
$arResult["USE_PASSWORD"] = true;
//from the login form
$_REQUEST["USER_PASSWORD"] = "";
}
if(isset($_REQUEST["USER_CURRENT_PASSWORD"]))
{
$arResult["USE_PASSWORD"] = true;
}
//stored in the system.auth.forgotpasswd/component.php
$arResult["USER_PHONE_NUMBER"] = $_SESSION["system.auth.changepasswd"]["USER_PHONE_NUMBER"];
$arResult["PHONE_REGISTRATION"] = (
COption::GetOptionString("main", "new_user_phone_auth", "N") == "Y"
&& $arResult["USER_PHONE_NUMBER"] <> ''
&& $arResult["USE_PASSWORD"] == false
);
if($arResult["PHONE_REGISTRATION"])
{
$arResult["PHONE_CODE_RESEND_INTERVAL"] = CUser::PHONE_CODE_RESEND_INTERVAL;
$arResult["SIGNED_DATA"] = \Bitrix\Main\Controller\PhoneAuth::signData([
'phoneNumber' => $arResult["USER_PHONE_NUMBER"],
'smsTemplate' => "SMS_USER_RESTORE_PASSWORD"
]);
}
$arParamsToDelete = array(
"login",
"logout",
"register",
"forgot_password",
"change_password",
"confirm_registration",
"confirm_code",
"confirm_user_id",
);
if(defined("AUTH_404"))
{
$arResult["AUTH_URL"] = POST_FORM_ACTION_URI;
}
else
{
$arResult["AUTH_URL"] = $APPLICATION->GetCurPageParam("change_password=yes", $arParamsToDelete);
}
$arResult["BACKURL"] = $APPLICATION->GetCurPageParam("", $arParamsToDelete);
$arResult["AUTH_AUTH_URL"] = $APPLICATION->GetCurPageParam("login=yes",$arParamsToDelete);
foreach ($arResult as $key => $value)
{
if (!is_array($value) && !is_bool($value))
{
$arResult[$key] = htmlspecialcharsbx($value);
}
}
$arRequestParams = array(
"USER_CHECKWORD",
"USER_CURRENT_PASSWORD",
"USER_PASSWORD",
"USER_CONFIRM_PASSWORD",
);
foreach ($arRequestParams as $param)
{
$arResult[$param] = ($_REQUEST[$param] <> ''? $_REQUEST[$param] : "");
$arResult[$param] = htmlspecialcharsbx($arResult[$param]);
}
if(isset($_GET["USER_LOGIN"]))
$arResult["~LAST_LOGIN"] = CUtil::ConvertToLangCharset($_GET["USER_LOGIN"]);
elseif(isset($_POST["USER_LOGIN"]))
$arResult["~LAST_LOGIN"] = $_POST["USER_LOGIN"];
else
$arResult["~LAST_LOGIN"] = $_COOKIE[COption::GetOptionString("main", "cookie_name", "BITRIX_SM")."_LOGIN"] ?? '';
$arResult["LAST_LOGIN"] = htmlspecialcharsbx($arResult["~LAST_LOGIN"]);
$userId = 0;
if($arResult["~LAST_LOGIN"] <> '')
{
$res = CUser::GetByLogin($arResult["~LAST_LOGIN"]);
if($profile = $res->Fetch())
{
$userId = $profile["ID"];
}
}
$arResult["GROUP_POLICY"] = CUser::GetGroupPolicy($userId);
$arResult["SECURE_AUTH"] = false;
if(!CMain::IsHTTPS() && COption::GetOptionString('main', 'use_encrypted_auth', 'N') == 'Y')
{
$sec = new CRsaSecurity();
if(($arKeys = $sec->LoadKeys()))
{
$sec->SetKeys($arKeys);
$sec->AddToForm('bform', ['USER_PASSWORD', 'USER_CONFIRM_PASSWORD', 'USER_CURRENT_PASSWORD']);
$arResult["SECURE_AUTH"] = true;
}
}
$arResult["USE_CAPTCHA"] = (COption::GetOptionString("main", "captcha_restoring_password", "N") == "Y" || $APPLICATION->NeedCAPTHAForLogin($arResult["~LAST_LOGIN"]));
if($arResult["USE_CAPTCHA"])
{
$arResult["CAPTCHA_CODE"] = htmlspecialcharsbx($APPLICATION->CaptchaGetCode());
}
$this->IncludeComponentTemplate();
'exception_handling' =>
array (
'value' =>
array (
'debug' => true,
'handled_errors_types' => 4437,
'exception_errors_types' => 4437,
'ignore_silence' => false,
'assertion_throws_exception' => true,
'assertion_error_type' => 256,
'log' => array (
'settings' =>
array (
'file' => '/var/log/php/exceptions.log',
'log_size' => 1000000,
),
),
),
'readonly' => false,
),