33 $manager = new \Bitrix\Sale\Rest\Synchronization\Manager();
37 $personId = \Bitrix\Sale\PersonType::getList([
'select'=>[
'ID',
'NAME'],
'order'=>
'ID',
'limit'=>1])->fetch()[
'ID'];
41 $manager->setDefaultPersonTypeId($personId);
45 $r->addError(
new Error(
'person type not found'));
48 $ps = Manager::getList(
51 'filter'=>[
'!ID'=>Manager::getInnerPaySystemId(),
'ENTITY_REGISTRY_TYPE'=>
'ORDER'],
52 'order'=>[
'ID'=>
'ASC'],
57 $paySystemId = isset($ps[0])? $ps[0][
'ID']:0;
58 if((
int)$paySystemId>0)
60 $manager->setDefaultPaySystemId($paySystemId);
64 $r->addError(
new Error(
'paysystem not found'));
68 if((
int)$deliverySystemId>0)
70 $manager->setDefaultDeliverySystemId($deliverySystemId);
74 $r->addError(
new Error(
'deliverysystem not found'));
77 $manager->setDefaultSiteId(SITE_ID);
89 $manager->deactivate();
104 $manager = new \Bitrix\Sale\Rest\Synchronization\Manager();
108 $internal[
'PERSON_TYPE'][$row[
'ID']] = $row;
110 foreach(\
Bitrix\
Sale\PaySystem\Manager::getList([
'select'=>[
'ID',
'NAME']])->fetchAll() as $row)
111 $internal[
'PAY_SYSTEMS'][$row[
'ID']] = $row;
114 $internal[
'DELIVERY_SYSTEMS'][$row[
'ID']] = $row;
116 $r = \CSite::GetList();
117 while ($row = $r->fetch())
118 $internal[
'SITES'][$row[
'ID']] = $row;
120 foreach(
OrderStatus::getList([
'select' => [
'*',
'NAME' =>
'Bitrix\Sale\Internals\StatusLangTable:STATUS.NAME'],
122 '=Bitrix\Sale\Internals\StatusLangTable:STATUS.LID' => LANGUAGE_ID
124 $internal[
'ORDER_STATUSES'][$row[
'ID']] = $row;
126 foreach(
DeliveryStatus::getList([
'select' => [
'*',
'NAME' =>
'Bitrix\Sale\Internals\StatusLangTable:STATUS.NAME'],
128 '=Bitrix\Sale\Internals\StatusLangTable:STATUS.LID' => LANGUAGE_ID
130 $internal[
'DELIVERY_STATUSES'][$row[
'ID']] = $row;
133 if(\
Bitrix\Main\Loader::includeModule(
'catalog'))
135 $r = \Bitrix\Catalog\CatalogIblockTable::getList([
136 'select' => [
'IBLOCK_ID',
'IBLOCK.NAME'],
137 'filter' => [
'=IBLOCK.ACTIVE'=>
'Y']]);
139 while($row = $r->fetch())
140 $catalogList[] = [
'id'=>$row[
'IBLOCK_ID'],
'name'=>$row[
'CATALOG_CATALOG_IBLOCK_IBLOCK_NAME']];
144 if(isset($internal[
'SITES'][$manager->getDefaultSiteId()]))
145 $site = $internal[
'SITES'][$manager->getDefaultSiteId()];
148 if(isset($internal[
'PAY_SYSTEMS'][$manager->getDefaultPaySystemId()]))
149 $paySystem = $internal[
'PAY_SYSTEMS'][$manager->getDefaultPaySystemId()];
152 if(isset($internal[
'DELIVERY_SYSTEMS'][$manager->getDefaultDeliverySystemId()]))
153 $deliverySystem = $internal[
'DELIVERY_SYSTEMS'][$manager->getDefaultDeliverySystemId()];
156 if(isset($internal[
'PERSON_TYPE'][$manager->getDefaultPersonTypeId()]))
157 $personType = $internal[
'PERSON_TYPE'][$manager->getDefaultPersonTypeId()];
160 if(isset($internal[
'ORDER_STATUSES'][$manager->getDefaultOrderStatusId()]))
161 $orderStatuses = $internal[
'ORDER_STATUSES'][$manager->getDefaultOrderStatusId()];
164 if(isset($internal[
'DELIVERY_STATUSES'][$manager->getDefaultDeliveryStatusId()]))
165 $deliveryStatus = $internal[
'DELIVERY_STATUSES'][$manager->getDefaultDeliveryStatusId()];
170 'isActive'=>$manager->isActive() && $manager->checkDefaultSettings()->isSuccess()?
'Y':
'N',
171 'site'=>count($site)>0? [
'id'=>$site[
'ID'],
'name'=>$site[
'NAME']]:[],
172 'paySystem'=>count($paySystem)>0? [
'id'=>$paySystem[
'ID'],
'name'=>$paySystem[
'NAME']]:[],
173 'deliverySystem'=>count($deliverySystem)>0? [
'id'=>$deliverySystem[
'ID'],
'name'=>$deliverySystem[
'NAME']]:[],
174 'personType'=>count($personType)>0? [
'id'=>$personType[
'ID'],
'name'=>$personType[
'NAME']]:[],
175 'orderStatus'=>count($orderStatuses)>0? [
'id'=>$orderStatuses[
'ID'],
'name'=>$orderStatuses[
'NAME']]:[],
176 'deliveryStatus'=>count($deliveryStatus)>0? [
'id'=>$deliveryStatus[
'ID'],
'name'=>$deliveryStatus[
'NAME']]:[],
177 'catalogs'=>$catalogList