21 protected static function getNavData($start, $orm =
false)
26 [
'limit' => \IRestService::LIST_LIMIT,
'offset' => intval($start)]
27 :[
'nPageSize' => \IRestService::LIST_LIMIT,
'iNumPage' => intval($start / \IRestService::LIST_LIMIT) + 1]
33 [
'limit' => \IRestService::LIST_LIMIT]
34 :[
'nTopCount' => \IRestService::LIST_LIMIT]
49 return ModuleManager::isModuleInstalled(
'crm');
57 ? new \Bitrix\Crm\Order\Builder\OrderBuilderRest($settings)
58 : new \Bitrix\Sale\Helpers\Order\Builder\OrderBuilderRest($settings);
64 'deleteClientsIfNotExists' =>
true,
65 'deleteTradeBindingIfNotExists' =>
true,
66 'deletePaymentIfNotExists' =>
true,
67 'deleteShipmentIfNotExists' =>
true,
68 'deleteShipmentItemIfNotExists' =>
true,
69 'deletePropertyValuesIfNotExists' =>
true,
70 'createDefaultPaymentIfNeed' =>
false,
71 'createDefaultShipmentIfNeed' =>
false,
72 'createUserIfNeed' =>
false,
73 'cacheProductProviderData' =>
false,
75 'acceptableErrorCodes' => []
81 $orderProperties = [];
83 if(isset($this->request->getFileList()[
'fields'][
'PROPERTIES']))
85 foreach ($this->request->getFileList()[
'fields'][
'PROPERTIES'] as $orderPropId => $arFileData)
87 if (is_array($arFileData))
89 foreach ($arFileData as $param_name => $value)
93 foreach ($value as $nIndex => $val)
95 if ($arFileData[
"name"][$nIndex] <>
'')
96 $orderProperties[$orderPropId][$nIndex][$param_name] = $val;
100 $orderProperties[$orderPropId][$param_name] = $value;
105 return $orderProperties;
111 $fields = array_merge($fields, $this->getAdditionalFields($order));
115 $director = new \Bitrix\Crm\Order\Rest\Normalizer\Director();
116 $normalizer = new \Bitrix\Crm\Order\Rest\Normalizer\ObjectNormalizer($fields);
120 $director = new \Bitrix\Sale\Rest\Normalizer\Director();
121 $normalizer = new \Bitrix\Sale\Rest\Normalizer\ObjectNormalizer($fields);
124 return $director->normalize($normalizer, $order);
132 $ixInternal[
'personType'][$row[
'ID']] = $row[
'XML_ID'];
135 $ixInternal[
'orderStatus'][$row[
'ID']] = $row[
'XML_ID'];
138 $ixInternal[
'properties'][$row[
'ID']] = $row[
'XML_ID'];
140 foreach(\
Bitrix\
Sale\PaySystem\Manager::getList([
'select'=>[
'ID',
'XML_ID',
'IS_CASH']])->fetchAll() as $row)
142 $ixInternal[
'paySystems'][$row[
'ID']][
'XML_ID'] = $row[
'XML_ID'];
143 $ixInternal[
'paySystems'][$row[
'ID']][
'IS_CASH'] = $row[
'IS_CASH'];
147 $ixInternal[
'deliverySystems'][$row[
'ID']] = $row[
'XML_ID'];
150 $ixInternal[
'deliveryStatus'][$row[
'ID']] = $row[
'XML_ID'];
152 foreach(\
Bitrix\
Sale\TradingPlatformTable::getList([
'select'=>[
'ID',
'XML_ID']])->fetchAll() as $row)
153 $ixInternal[
'tradingPlatform'][$row[
'ID']] = $row[
'XML_ID'];
156 $r[
'ORDER'][$order->getInternalId()] = [
157 'PERSON_TYPE_XML_ID'=>$ixInternal[
'personType'][$order->getPersonTypeId()],
158 'STATUS_XML_ID'=>$ixInternal[
'orderStatus'][$order->getField(
'STATUS_ID')]];
160 foreach ($order->getPropertyCollection() as $property)
161 $r[
'PROPERTIES'][$property->getInternalIndex()] = [
'ORDER_PROPS_XML_ID'=>$ixInternal[
'properties'][$property->getPropertyId()]];
163 foreach ($order->getPaymentCollection() as $payment)
164 $r[
'PAYMENTS'][$payment->getInternalIndex()] = [
165 'PAY_SYSTEM_XML_ID'=>$ixInternal[
'paySystems'][$payment->getPaymentSystemId()][
'XML_ID'],
166 'PAY_SYSTEM_IS_CASH'=>$ixInternal[
'paySystems'][$payment->getPaymentSystemId()][
'IS_CASH']
170 foreach ($order->getShipmentCollection() as $shipment)
172 $shipmentIndex = $shipment->getInternalIndex();
173 $r[
'SHIPMENTS'][$shipmentIndex] = [
174 'DELIVERY_XML_ID'=>$ixInternal[
'deliverySystems'][$shipment->getDeliveryId()],
175 'STATUS_XML_ID'=>$ixInternal[
'deliveryStatus'][$shipment->getField(
'STATUS_ID')]];
179 foreach ($order->getTradeBindingCollection() as $binding)
180 if($binding->getTradePlatform() !==
null)
181 $r[
'TRADE_BINDINGS'][$binding->getInternalIndex()] = [
'TRADING_PLATFORM_XML_ID'=>$ixInternal[
'tradingPlatform'][$binding->getTradePlatform()->getId()]];