Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/sale/lib/exchange/ |
Upload File : |
<?php namespace Bitrix\Sale\Exchange; use Bitrix\Sale\Exchange\Entity\EntityImport; use Bitrix\Sale\Exchange\OneC\DocumentType; trait PackageTrait { /** * @param ImportBase $item * @param array $fields * @param null $order */ protected static function load(ImportBase $item, array $fields, $order=null) { if($item->getOwnerTypeId() <> static::getParentEntityTypeId()) { if($item instanceof EntityImport) { $item->setParentEntity($order); } } $item->load($fields); } /** * @param array $fields * @return array */ protected function getProductsItems(array $fields) { return (isset($fields['ITEMS']) && is_array($fields['ITEMS'])) ? $fields['ITEMS']:array(); } /** * @param $type_id * @param OneC\DocumentBase[] $documents * @return bool */ protected function hasDocumentByTypeId($type_id, array $documents) { $documentImport = $this->getDocumentByTypeId($type_id, $documents); return ($documentImport !== null); } /** * @param $type_id * @param OneC\DocumentBase[] $documents * @return OneC\DocumentBase|null */ protected function getDocumentByTypeId($type_id, array $documents) { foreach($documents as $document) { if(DocumentType::isDefined($type_id)) { if($document->getTypeId() == $type_id) { return $document; } } } return null; } /** * @param $type_id * @param ImportBase[] $items * @return ImportBase|null */ protected function getEntityByTypeId($type_id, array $items) { foreach($items as $item) { if(EntityType::isDefined($type_id)) { if($item->getOwnerTypeId() == $type_id) { return $item; } } } return null; } /** * @param array $list * @return bool */ protected function deliveryServiceExists(array $list) { $deliveryItem = $this->getDeliveryServiceItem($list); return !($deliveryItem === null); } }