• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/rest/synchronization/manager.php
  • Класс: BitrixSaleRestSynchronizationManager
  • Вызов: Manager::checkDefaultSettings
public function checkDefaultSettings()
{
	$result = new Result();

	$siteId='';
	$r = CSite::GetList();
	while ($row = $r->fetch())
		if($row['ID']==$this->getDefaultSiteId())
			$siteId=$row['ID'];

	if($siteId=='')
		$result->addError(new Error(Loc::getMessage('MAN_ERROR_EMPTY_FIELD_SITE')));

	$deliverySystemId=0;
	foreach(BitrixSaleDeliveryServicesManager::getActiveList() as $row)
		if($row['ID']==$this->getDefaultDeliverySystemId())
			$deliverySystemId = $row['ID'];
	if($deliverySystemId==0)
		$result->addError(new Error(Loc::getMessage('MAN_ERROR_EMPTY_FIELD_DELIVERY_SERVICES')));

	if(count(BitrixSalePaySystemManager::getList(['filter'=>['ID'=>$this->getDefaultPaySystemId()]]))<=0)
		$result->addError(new Error(Loc::getMessage('MAN_ERROR_EMPTY_FIELD_PAY_SYSTEM')));
	if(count(BitrixSalePersonType::getList(['filter'=>['ID'=>$this->getDefaultPersonTypeId()]]))<=0)
		$result->addError(new Error(Loc::getMessage('MAN_ERROR_EMPTY_FIELD_PERSON_TYPE')));
	if(count(BitrixSaleOrderStatus::getList(['filter'=>['ID'=>$this->getDefaultOrderStatusId()]]))<=0)
		$result->addError(new Error('MAN_ERROR_EMPTY_FIELD_ORDER_STATUS'));
	if(count(BitrixSaleDeliveryStatus::getList(['filter'=>['ID'=>$this->getDefaultDeliveryStatusId()]]))<=0)
		$result->addError(new Error('MAN_ERROR_EMPTY_FIELD_DELIVERY_STATUS'));

	$catalogList=[];
	if(BitrixMainLoader::includeModule('catalog'))
	{
		$catalogList = BitrixCatalogCatalogIblockTable::getList([
			'select' => ['IBLOCK_ID', 'IBLOCK.NAME'],
			'filter' => ['=IBLOCK.ACTIVE'=>'Y']
		])->fetchAll();
	}
	if(!count($catalogList)>0)
		$result->addError(new Error(Loc::getMessage('MAN_ERROR_CATALOGS')));

	return $result;
}