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/yandex.market/lib/api/model/order/ |
Upload File : |
<?php namespace Yandex\Market\Api\Model\Order; use Bitrix\Main; use Yandex\Market; class Shipment extends Market\Api\Reference\Model { public function getShipmentDate() { if (!$this->hasField('shipmentDate')) { return null; } $date = Market\Data\Date::convertFromService($this->getField('shipmentDate')); $time = (string)$this->getShipmentTime(); if ($time === '') { return $date; } $timeParts = Market\Data\Time::parse($time); if ($timeParts === null) { return $date; } $dateWithTime = Main\Type\DateTime::createFromTimestamp($date->getTimestamp()); $dateWithTime->setTime($timeParts[0], $timeParts[1]); return $dateWithTime; } public function getShipmentTime() { return $this->getField('shipmentTime'); } public function getWidth() { return Market\Data\Number::normalize($this->getField('width')); } public function getHeight() { return Market\Data\Number::normalize($this->getField('height')); } public function getDepth() { return Market\Data\Number::normalize($this->getField('depth')); } public function getSizeUnit() { return Market\Data\Size::UNIT_CENTIMETER; } public function getWeight() { return Market\Data\Number::normalize($this->getField('weight')); } public function getWeightUnit() { return Market\Data\Weight::UNIT_GRAM; } public function hasSavedBoxes() { return parent::hasField('boxes'); } public function getBoxes() { return $this->getCollection('boxes', BoxCollection::class); } public function hasField($name) { $result = parent::hasField($name); if ($result === false && $name === 'boxes' && $this->hasField('items')) // convert old boxes format to new { $result = true; } return $result; } public function getField($name) { $result = parent::getField($name); if ($name === 'boxes' && $result === null && $this->hasField('items')) // convert old boxes format to new { $virtualBox = array_intersect_key($this->getFields(), [ 'items' => true, 'weight' => true, 'width' => true, 'height' => true, 'depth' => true, ]); $result = [ $virtualBox ]; } return $result; } }