27 function($className, $id) {
34 $orderClass = $registry->getOrderClassName();
37 $order = $orderClass::load($id);
44 $this->
addError(
new Error(
'order is not exists', 200540400001));
53 $entity = new \Bitrix\Sale\Rest\Entity\Order();
54 return [
'ORDER'=>$entity->prepareFieldInfos(
62 return $this->toArray($order);
65 public function tryModifyAction(array $fields)
67 $r = $this->modify($fields);
72 $order = $r->getData()[
'ORDER'];
74 $result = $this->toArray($order);
76 if(is_array($result[
'ORDER'][
'PAYMENTS']))
78 foreach ($result[
'ORDER'][
'PAYMENTS'] as $ix=>&$fields)
80 $paySystems = Manager::getListWithRestrictions(
82 ->getPaymentCollection()
86 foreach ($paySystems as $paySystem)
88 if((
int)$paySystem[
'PAY_SYSTEM_ID']>0)
90 $fields[
'LIST_PAY_SYSTEM_WITH_RESTRICTIONS'][]=[
91 'ID'=>$paySystem[
'PAY_SYSTEM_ID'],
98 if(is_array($result[
'ORDER'][
'SHIPMENTS']))
100 foreach ($result[
'ORDER'][
'SHIPMENTS'] as $ix=>&$fields)
102 $services = \Bitrix\Sale\Delivery\Services\Manager::getRestrictedObjectsList(
104 ->getShipmentCollection()
105 ->getItemByIndex($ix)
108 foreach ($services as $service)
110 $fields[
'LIST_DELIIVERY_SERVICES_RESTRICTIONS'][]=[
111 'ID'=>$service->getId(),
125 public function modifyAction(array $fields)
127 $r = $this->
modify($fields);
132 $order = $r->getData()[
'ORDER'];
140 elseif($r->hasWarnings())
149 elseif($r->hasWarnings())
163 $r = $this->
add($fields);
167 $order = $r->getData()[
'ORDER'];
168 return $this->toArray($order);
177 public function addAction(array $fields)
181 $r = $this->add($fields);
186 $order = $r->getData()[
'ORDER'];
191 $this->addErrors($r->getErrors());
196 return $this->toArray($order);
200 $this->addErrors($r->getErrors());
207 $r = $this->
update($order, $fields);
211 $order = $r->getData()[
'ORDER'];
212 return $this->toArray($order);
224 $r = $this->update($order, $fields);
229 $order = $r->getData()[
'ORDER'];
234 $this->addErrors($r->getErrors());
239 return $this->toArray($order);
243 $this->addErrors($r->getErrors());
248 public function listAction(PageNavigation $pageNavigation, array $select = [], array $filter = [], array $order = []): Page
250 $select = empty($select) ? [
'*'] : $select;
251 $order = empty($order) ? [
'ID' =>
'ASC'] : $order;
253 new \Bitrix\Main\Entity\ReferenceField(
255 '\Bitrix\Sale\Internals\PersonType',
256 array(
'=this.PERSON_TYPE_ID' =>
'ref.ID')
258 new \Bitrix\Main\Entity\ReferenceField(
260 '\Bitrix\Sale\Internals\StatusTable',
261 array(
'=this.STATUS_ID' =>
'ref.ID')
268 $orderClass = $registry->getOrderClassName();
270 $orders = $orderClass::getList(
275 'offset'=>$pageNavigation->getOffset(),
276 'limit'=>$pageNavigation->getLimit(),
281 return new Page(
'ORDERS', $orders,
function() use ($select, $filter, $runtime)
286 $orderClass = $registry->getOrderClassName();
289 $orderClass::getList([
'select'=>$select,
'filter'=>$filter,
'runtime'=>$runtime])->fetchAll()
296 $r = $order->delete($order->getId());
306 if ($r->hasWarnings())
317 return [
'DELIVERY_ID_LIST'=>$order->getDeliveryIdList()];
322 return [
'PAYMENTS'=>$this->toArray($order)[
'ORDER'][
'PAYMENTS']];
327 return [
'PAY_SYSTEM_ID_LIST'=>$order->getPaySystemIdList()];
332 return [
'PRINTED_CHECKS'=>$order->getPrintedChecks()];
337 return [
'SHIPMENTS'=>$this->toArray($order)[
'ORDER'][
'SHIPMENTS']];
342 return [
'BASKET_ITEMS'=>$this->toArray($order)[
'ORDER'][
'BASKET_ITEMS']];
347 return $order->getField(
'CURRENCY');
352 return $order->getField(
'DATE_INSERT');
358 return $this->toArray($order)[
'DISCOUNTS'];
363 return $order->getPersonTypeId();
368 return $order->getPrice();
373 return [
'PROPERTY_VALUES'=>$this->toArray($order)[
'ORDER'][
'PROPERTY_VALUES']];
378 return $order->getSiteId();
383 return $order->getSumPaid();
399 return $order->getTaxPrice();
404 return $order->getTaxValue();
409 return $order->getUserId();
414 return $order->getVatRate();
419 return $order->getVatSum();
424 return $order->isCanceled()?
'Y':
'N';
429 return $order->isExternal()?
'Y':
'N';
434 return $order->isMarked()?
'Y':
'N';
439 return $order->isPaid()?
'Y':
'N';
444 return $order->isShipped()?
'Y':
'N';
449 return $order->isUsedVat()?
'Y':
'N';
476 $builder = $this->getBuilder();
478 $builder->build($fields);
479 $errorsContainer = $builder->getErrorsContainer();
483 if($builder->getErrorsContainer()->getErrorCollection()->count()<=0)
485 $builder->getErrorsContainer()->addError(
new Error(
'unknow error', 200550000001));
487 $errorsContainer = $builder->getErrorsContainer();
490 if($errorsContainer->getErrorCollection()->count()>0)
491 $r->addErrors($errorsContainer->getErrors());
493 $r->setData([
'ORDER'=>$builder->getOrder()]);
498 protected function add(array $fields)
502 $fields = [
'ORDER'=>$fields];
504 if($fields[
'ORDER'][
'ID'])
505 unset($fields[
'ORDER'][
'ID']);
507 $orderBuilder = $this->getBuilder();
508 $order = $orderBuilder->buildEntityOrder($fields);
510 if($orderBuilder->getErrorsContainer()->getErrorCollection()->count()>0)
511 $r->addErrors($orderBuilder->getErrorsContainer()->getErrors());
513 $r->setData([
'ORDER'=>$order]);
523 $data[
'ORDER'] = $fields;
524 $data[
'ORDER'][
'ID'] = $order->getId();
525 $data[
'ORDER'][
'PERSON_TYPE_ID'] = $order->getPersonTypeId();
527 $orderBuilder = $this->getBuilder();
528 $order = $orderBuilder->buildEntityOrder($data);
530 if($orderBuilder->getErrorsContainer()->getErrorCollection()->count()>0)
531 $r->addErrors($orderBuilder->getErrorsContainer()->getErrors());
533 $r->setData([
'ORDER'=>$order]);
540 return $this->toArray($order, $fields);
545 $fields = isset($fields[
'ORDER'])? $fields[
'ORDER']:[];
547 if(isset($fields[
'BASKET_ITEMS']))
548 unset($fields[
'BASKET_ITEMS']);
549 if(isset($fields[
'PROPERTY_VALUES']))
550 unset($fields[
'PROPERTY_VALUES']);
551 if(isset($fields[
'PAYMENTS']))
552 unset($fields[
'PAYMENTS']);
553 if(isset($fields[
'SHIPMENTS']))
554 unset($fields[
'SHIPMENTS']);
555 if(isset($fields[
'TRADE_BINDINGS']))
556 unset($fields[
'TRADE_BINDINGS']);
557 if(isset($fields[
'CLIENTS']))
558 unset($fields[
'CLIENTS']);
559 if(isset($fields[
'REQUISITE_LINKS']))
560 unset($fields[
'REQUISITE_LINKS']);
565 private static function setFlagActionImport()
568 $instance = \Bitrix\Sale\Rest\Synchronization\Manager::getInstance();
569 $instance->setAction(\
Bitrix\
Sale\
Rest\Synchronization\Manager::ACTION_IMPORT);
574 self::setFlagActionImport();
579 public function resolveExternalIdToInternalId(array $fields)
581 LoggerDiag::addMessage(
'ORDER_RESOLVE_EXTERNAL_ID_TO_INTERNAL_ID_SOURCE_FIELDS', var_export($fields,
true));
585 $instance = \Bitrix\Sale\Rest\Synchronization\Manager::getInstance();
589 $internalOrderId = -1;
591 $externalId = $fields[
'ORDER'][
'XML_ID'];
592 $ixExternal[
'ORDER'][
'MAP'][$externalId] = $fields[
'ORDER'][
'ID'];
594 unset($fields[
'ORDER'][
'ID']);
596 if(intval($internalId)>0)
598 $fields[
'ORDER'][
'ID'] = $internalId;
599 $ixInternal[
'ORDER'][
'MAP'][$externalId] = $internalId;
600 $internalOrderId = $fields[
'ORDER'][
'ID'];
604 $fields[
'ORDER'][
'STATUS_ID' ] = $internalOrderStatusId<>
''? $internalOrderStatusId:$instance->getDefaultOrderStatusId();
608 if(intval($internalId)<=0)
611 $internalPersonTypeId = $this->getInternalId($fields[
'ORDER'][
'PERSON_TYPE_XML_ID'],
'PERSON_TYPE_TYPE');
612 $fields[
'ORDER'][
'PERSON_TYPE_ID'] = $internalPersonTypeId>0 ? $internalPersonTypeId:$instance->getDefaultPersonTypeId();
613 $fields[
'ORDER'][
'USER_ID'] = \CSaleUser::GetAnonymousUserID();
614 $fields[
'ORDER'][
'SITE_ID'] = $instance->getDefaultSiteId();
621 $orderClass = $registry->getOrderClassName();
623 $order = $orderClass::load($internalId);
624 $fields[
'ORDER'][
'PERSON_TYPE_ID'] = $order->getPersonTypeId();
625 $fields[
'ORDER'][
'USER_ID'] = $order->getUserId();
626 $fields[
'ORDER'][
'SITE_ID'] = $order->getSiteId();
629 if(is_array($fields[
'ORDER'][
'PROPERTY_VALUES']))
631 foreach($fields[
'ORDER'][
'PROPERTY_VALUES'] as $k=>&$item)
633 $internalIdExternalSystem = $item[
'ORDER_PROPS_ID'];
634 $externalId = $item[
'ORDER_PROPS_XML_ID'];
636 unset($item[
'ORDER_PROPS_ID']);
637 unset($item[
'ORDER_PROPS_XML_ID']);
642 $ixExternal[
'PROPERTIES'][$k][
'MAP'][$externalId] = $internalIdExternalSystem;
645 if(intval($internalId)>0)
647 $item[
'ORDER_PROPS_ID'] = $internalId;
648 $ixInternal[
'PROPERTIES'][$k][
'MAP'][$externalId] = $internalId;
658 if(is_array($fields[
'ORDER'][
'BASKET_ITEMS']))
661 foreach($fields[
'ORDER'][
'BASKET_ITEMS'] as $k=>&$item)
663 $internalIdExternalSystem = $item[
'ID'];
664 $externalId = $item[
'XML_ID'];
667 $internalBasketItemId = (intval($internalId)>0)? $internalId:-1;
668 $ixInternal[
'BASKET_ITEMS'][$k][
'MAP'][$externalId] = (intval($internalId)>0)? $internalId:
'n'.$n++;
669 $ixExternal[
'BASKET_ITEMS'][$k][
'MAP'][$externalId] = $internalIdExternalSystem;
671 $properties = $item[
'PROPERTIES'];
672 if(count($properties)>0)
674 foreach ($properties as $kp=>&$property)
676 $property[
'BASKET_ID'] = $ixInternal[
'BASKET_ITEMS'][$k][
'MAP'][$externalId];
678 if(intval($internalIdBasketProps)>0)
680 $ixInternal[
'BASKET_ITEMS'][$k][
'PROPERTIES'][$kp][$property[
'XML_ID']] = $internalIdBasketProps;
681 $property[
'ID'] = $internalIdBasketProps;
683 $ixExternal[
'BASKET_ITEMS'][$k][
'PROPERTIES'][$kp][
'MAP'][$property[
'XML_ID']] = $property[
'ID'];
689 [
'PROPERTIES'=>$properties],
690 $this->prepareFieldsBasketItem($item)
693 $item[
'ID'] = $ixInternal[
'BASKET_ITEMS'][$k][
'MAP'][$externalId];
697 if(is_array($fields[
'ORDER'][
'PAYMENTS']))
699 foreach($fields[
'ORDER'][
'PAYMENTS'] as $k=>&$item)
701 $externalId = $item[
'XML_ID'];
702 $ixExternal[
'PAYMENTS'][$k][
'MAP'][$externalId] = $item[
'ID'];
706 if(intval($internalId)>0)
708 $item[
'ID'] = $internalId;
709 $ixInternal[
'PAYMENTS'][$k][
'MAP'][$externalId] = $internalId;
712 $externalPaySystemId = $item[
'PAY_SYSTEM_XML_ID'];
713 $ixExternal[
'PAYMENTS'][$k][
'PAY_SYSTEMS'][
'MAP'][$externalPaySystemId] = $item[
'PAY_SYSTEM_ID'];
715 unset($item[
'PAY_SYSTEM_XML_ID']);
716 $internalPaySystemId = $this->
getInternalId($externalPaySystemId,
'PAY_SYSTEM_TYPE');
717 $item[
'PAY_SYSTEM_ID'] = $internalPaySystemId>0 ? $internalPaySystemId:$instance->getDefaultPaySystemId();
718 $ixInternal[
'PAYMENTS'][$k][
'PAY_SYSTEM'][
'MAP'][$externalPaySystemId] = $item[
'PAY_SYSTEM_ID'];
722 if(is_array($fields[
'ORDER'][
'SHIPMENTS']))
724 foreach($fields[
'ORDER'][
'SHIPMENTS'] as $k=>&$item)
726 $externalId = $item[
'XML_ID'];
727 $ixExternal[
'SHIPMENTS'][$k][
'MAP'][$externalId] = $item[
'ID'];
731 $internalShipmentId = (intval($internalId)>0)? $internalId:-1;
732 if(intval($internalId)>0)
734 $item[
'ID'] = $internalId;
735 $ixInternal[
'SHIPMENTS'][$k][$externalId] = $internalId;
738 $externalDeliveryId = $item[
'DELIVERY_XML_ID'];
739 $ixExternal[
'SHIPMENTS'][$k][
'DELIVERY_SYSTEM'][
'MAP'][$externalDeliveryId] = $item[
'DELIVERY_ID'];
741 unset($item[
'DELIVERY_XML_ID']);
742 $internalDeliveryId = $this->
getInternalId($externalDeliveryId,
'DELIVERY_SYSTEM_TYPE');
743 $item[
'DELIVERY_ID'] = $internalDeliveryId>0 ? $internalDeliveryId:$instance->getDefaultDeliverySystemId();
744 $ixInternal[
'SHIPMENTS'][$k][
'DELIVERY_SYSTEM'][
'MAP'][$externalDeliveryId] = $item[
'DELIVERY_ID'];
746 $externalDeliveryStatusId = $item[
'STATUS_XML_ID'];
747 $ixExternal[
'SHIPMENTS'][$k][
'DELIVERY_STATUS'][
'MAP'][$externalDeliveryStatusId] = $item[
'STATUS_ID'];
749 unset($item[
'STATUS_XML_ID']);
751 $item[
'STATUS_ID'] = $internalDeliveryStatusId<>
''? $internalDeliveryStatusId:$instance->getDefaultDeliveryStatusId();
752 $ixInternal[
'SHIPMENTS'][$k][
'DELIVERY_STATUS'][
'MAP'][$externalDeliveryStatusId] = $item[
'STATUS_ID'];
754 foreach($item[
'SHIPMENT_ITEMS'] as $kb=>&$shipmentItem)
756 unset($shipmentItem[
'ID']);
757 unset($shipmentItem[
'ORDER_DELIVERY_ID']);
760 if(intval($internalIdShipmentItem)>0)
762 $shipmentItem[
'ID'] = $internalIdShipmentItem;
763 if(intval($internalId)>0)
764 $shipmentItem[
'ORDER_DELIVERY_ID'] = $internalId;
766 $ixInternal[
'SHIPMENTS'][$k][
'SHIPMENT_ITEMS'][$kb][
'MAP'][$externalId] = $internalIdShipmentItem;
771 foreach ($ixExternal[
'BASKET_ITEMS'] as $map)
773 $internal = current($map[
'MAP']);
775 if($shipmentItem[
'BASKET_ID'] == $internal)
777 $external = key($map[
'MAP']);
783 $result->addError(
new Error(
'Modify fields error. ShipmentItem xmlId is invalid',200550000002));
788 foreach ($ixInternal[
'BASKET_ITEMS'] as $map)
790 if(isset($map[
'MAP'][$external]))
792 $shipmentItem[
'BASKET_ID'] = $map[
'MAP'][$external];
799 $item = $this->prepareFieldsShipment($item);
803 if($this->isCrmModuleInstalled())
805 if(is_array($fields[
'ORDER'][
'TRADE_BINDINGS']))
807 foreach($fields[
'ORDER'][
'TRADE_BINDINGS'] as $k=>&$item)
809 $externalId = $item[
'XML_ID'];
810 $ixExternal[
'TRADE_BINDINGS'][$k][
'MAP'][$externalId] = $item[
'ID'];
816 if(intval($internalId)>0)
818 $item[
'ID'] = $internalId;
819 $ixInternal[
'TRADE_BINDINGS'][$k][
'MAP'][$externalId] = $internalId;
823 $externalTradePlatformId = $item[
'TRADING_PLATFORM_XML_ID'];
824 $ixExternal[
'TRADE_BINDINGS'][$k][
'TRADING_PLATFORMS'][
'MAP'][$externalTradePlatformId] = $item[
'TRADING_PLATFORM_ID'];
826 unset($item[
'TRADING_PLATFORM_XML_ID']);
827 $internalTradePlatformId = $this->
getInternalId($externalTradePlatformId,
'TRADING_PLATFORM_TYPE');
829 $item[
'TRADING_PLATFORM_ID'] = $internalTradePlatformId>0 ? $internalTradePlatformId:0;
830 $ixInternal[
'TRADE_BINDINGS'][$k][
'TRADING_PLATFORM'][
'MAP'][$externalTradePlatformId] = $item[
'TRADING_PLATFORM_ID'];
834 if(is_array($fields[
'ORDER'][
'CLIENTS']))
836 foreach($fields[
'ORDER'][
'CLIENTS'] as $k=>&$item)
838 $externalId = $item[
'XML_ID'];
839 $ixExternal[
'CLIENTS'][$k][
'MAP'][$externalId] = $item[
'ID'];
842 $internalId = $this->
getInternalId($externalId, ENTITY_CRM_CONTACT_COMPANY_COLLECTION);
843 if(intval($internalId)>0)
845 $item[
'ID'] = $internalId;
846 $ixInternal[
'CLIENTS'][$k][
'MAP'][$externalId] = $internalId;
855 $fields[
'ORDER'][
'TRADE_BINDINGS'] = [];
856 unset($fields[
'ORDER'][
'CLIENTS']);
859 if($result->isSuccess())
861 $result->setData([
'DATA'=>$fields]);
862 LoggerDiag::addMessage(
'ORDER_RESOLVE_EXTERNAL_ID_TO_INTERNAL_ID_SUCCESS', var_export($fields,
true));
866 LoggerDiag::addMessage(
'ORDER_RESOLVE_EXTERNAL_ID_TO_INTERNAL_ID_ERROR');
875 return $loader->getFieldsByExternalId($externalId);
878 private function prepareFieldsBasketItem($fields)
880 $instance = \Bitrix\Sale\Rest\Synchronization\Manager::getInstance();
883 $code = $loader->getCodeAfterDelimiter($fields[
'PRODUCT_XML_ID']);
884 $product = $code<>
'' ? $loader->getFieldsByExternalId($code):array();
886 $product = $loader->getFieldsByExternalId($fields[
'PRODUCT_XML_ID']);
891 "PRODUCT_ID" => $product[
"ID"],
892 "NAME" => $product[
"NAME"],
893 "MODULE" =>
"catalog",
894 "PRODUCT_PROVIDER_CLASS" =>
"CCatalogProductProvider",
895 "CATALOG_XML_ID" => $product[
"IBLOCK_XML_ID"],
896 "DETAIL_PAGE_URL" => $product[
"DETAIL_PAGE_URL"],
897 "WEIGHT" => $product[
"WEIGHT"],
898 "NOTES" => $product[
"CATALOG_GROUP_NAME"]
905 "PRODUCT_ID" => $ri->rand(1000000, 9999999),
906 "NAME" => $fields[
"NAME"],
908 "PRODUCT_PROVIDER_CLASS" =>
null,
909 "CATALOG_XML_ID" =>
null,
910 "MEASURE_CODE" => $fields[
"MEASURE_CODE"],
911 "MEASURE_NAME" => $fields[
"MEASURE_NAME"],
916 $result[
"LID"] = $instance->getDefaultSiteId();
917 $result[
"QUANTITY"] = $fields[
"QUANTITY"];
918 $result[
"CURRENCY"] = $fields[
"CURRENCY"];
919 $result[
"DELAY"] =
"N";
920 $result[
"CAN_BUY"] =
"Y";
921 $result[
"IGNORE_CALLBACK_FUNC"] =
"Y";
922 $result[
"PRODUCT_XML_ID"] = $fields[
"PRODUCT_XML_ID"];
923 $result[
"XML_ID"] = $fields[
"XML_ID"];
925 $result[
"PRICE"] = $fields[
"PRICE"];
927 $result[
"VAT_RATE"] = $fields[
"VAT_RATE"];
928 $result[
"VAT_INCLUDED"] = $fields[
"VAT_INCLUDED"];
933 private function prepareFieldsShipment($item)
937 $item[
'CUSTOM_PRICE_DELIVERY'] =
'Y';
946 self::setFlagActionImport();
950 LoggerDiag::addMessage(
'ORDER_IMPORT_ACTION_WITH_RESOLVE_EXTERNAL_ID_TO_INTERNAL_ID', var_export($fields,
true));
952 $r = $this->resolveExternalIdToInternalId($fields);
956 $result = $this->modifyAction($r->getData()[
'DATA']);
965 LoggerDiag::addMessage(
'ORDER_IMPORT_ACTION_WITH_RESOLVE_EXTERNAL_ID_TO_INTERNAL_ID_ERROR', var_export($this->
getErrors(),
true));
970 LoggerDiag::addMessage(
'ORDER_IMPORT_ACTION_WITH_RESOLVE_EXTERNAL_ID_TO_INTERNAL_ID_SUCCESS');
981 'PERSON_TYPE_XML_ID',
990 $orderPropertyValuesFields = [
993 'ORDER_PROPS_XML_ID',
998 $basketItemFields = [
1012 $basketItemPropertiesFields = [
1020 'PAY_SYSTEM_XML_ID',
1031 'PAY_RETURN_COMMENT',
1036 'BASE_PRICE_DELIVERY',
1040 'REASON_UNDO_DEDUCTED',
1042 'DELIVERY_DOC_DATE',
1054 $shipmentItemsFields = [
1060 $result[
'ORDER'] = array_intersect_key($fields[
'ORDER'], array_flip($orderFields));
1062 if(isset($fields[
'ORDER'][
'PROPERTY_VALUES']))
1064 foreach($fields[
'ORDER'][
'PROPERTY_VALUES'] as $k=>$v)
1065 $result[
'ORDER'][
'PROPERTY_VALUES'][$k] = array_intersect_key($v, array_flip($orderPropertyValuesFields));
1068 if(isset($fields[
'ORDER'][
'BASKET_ITEMS']))
1070 foreach($fields[
'ORDER'][
'BASKET_ITEMS'] as $k=>$item)
1072 $result[
'ORDER'][
'BASKET_ITEMS'][$k] = array_intersect_key($item, array_flip($basketItemFields));
1074 if(isset($item[
'PROPERTIES']))
1076 foreach($item[
'PROPERTIES'] as $kProps=>$pros)
1078 $result[
'ORDER'][
'BASKET_ITEMS'][$k][
'PROPERTIES'][$kProps] = array_intersect_key($pros, array_flip($basketItemPropertiesFields));
1084 if(isset($fields[
'ORDER'][
'PAYMENTS']))
1086 foreach($fields[
'ORDER'][
'PAYMENTS'] as $k=>$payment)
1088 $result[
'ORDER'][
'PAYMENTS'][$k] = array_intersect_key($payment, array_flip($paymentFields));
1092 if(isset($fields[
'ORDER'][
'SHIPMENTS']))
1094 foreach($fields[
'ORDER'][
'SHIPMENTS'] as $k=>$shipment)
1096 $result[
'ORDER'][
'SHIPMENTS'][$k] = array_intersect_key($shipment, array_flip($shipmentFields));
1098 if(isset($shipment[
'SHIPMENT_ITEMS']))
1100 foreach($shipment[
'SHIPMENT_ITEMS'] as $kShipmentItem=>$shipmentItem)
1102 $result[
'ORDER'][
'SHIPMENTS'][$k][
'SHIPMENT_ITEMS'][$kShipmentItem] = array_intersect_key($shipmentItem, array_flip($shipmentItemsFields));
1113 if($name ==
'getdeliveryidlist'
1114 || $name ==
'getpayments'
1115 || $name ==
'getpaysystemidlist'
1116 || $name ==
'getprintedchecks'
1117 || $name ==
'getshipments'
1118 || $name ==
'getbasket'
1119 || $name ==
'getcurrency'
1120 || $name ==
'getdateinsert'
1121 || $name ==
'getdeliverylocation'
1122 || $name ==
'getapplydiscount'
1123 || $name ==
'getpersontypeid'
1124 || $name ==
'getprice'
1125 || $name ==
'getpropertyvalues'
1126 || $name ==
'getsiteid'
1127 || $name ==
'getsumpaid'
1128 || $name ==
'gettaxlist'
1129 || $name ==
'gettaxlocation'
1130 || $name ==
'gettaxprice'
1131 || $name ==
'gettaxvalue'
1132 || $name ==
'getuserid'
1133 || $name ==
'getvatrate'
1134 || $name ==
'getvatsum'
1135 || $name ==
'iscanceled'
1136 || $name ==
'isexternal'
1137 || $name ==
'ismarked'
1138 || $name ==
'ispaid'
1139 || $name ==
'isshipped'
1140 || $name ==
'isusedvat'
1143 $r = $this->checkReadPermissionEntity();
1145 elseif($name ==
'import'
1146 || $name ==
'importdelete'
1149 $r = $this->checkModifyPermissionEntity();
1153 $r = parent::checkPermissionEntity($name);