diff --git a/vendor/magento/module-shipping/view/adminhtml/web/order/packaging.js b/vendor/magento/module-shipping/view/adminhtml/web/order/packaging.js index 38ba66d3543..b65130ced36 100644 --- a/vendor/magento/module-shipping/view/adminhtml/web/order/packaging.js +++ b/vendor/magento/module-shipping/view/adminhtml/web/order/packaging.js @@ -71,6 +71,15 @@ define(['prototype'], function () { if (this.packagesContent.childElements().length == 0) { this.newPackage(); } + const allowedPackageTypes = ["N","D"]; + + if (!Object.values(this.customizableContainers).some(packageType => allowedPackageTypes.includes(packageType))) { + $('packaging_window').select( + 'th.col-length,th.col-width,th.col-height' + ).forEach(element => { + element.classList.remove('_required') + }); + } jQuery(this.window).modal('openModal'); }, @@ -262,7 +271,15 @@ define(['prototype'], function () { } dimensionElements.each(callback); - return result = $$('[id^="package_block_"] input').collect(function (element) { + const allowedPackageTypes = ["N","D"]; + + if (Object.values(this.customizableContainers).some(packageType => allowedPackageTypes.includes(packageType))) { + dimensionElements.each(function(element) { + $(element).addClassName('required-entry'); + }); + } + + return result = $$('[id^="package_block_"] input').collect(function (element) { return this.validateElement(element); }, this).all(); }, diff --git a/vendor/magento/module-shipping/view/adminhtml/templates/order/packaging/popup_content.phtml b/vendor/magento/module-shipping/view/adminhtml/templates/order/packaging/popup_content.phtml index 71299b33ff15..1990408cd68a 100644 --- a/vendor/magento/module-shipping/view/adminhtml/templates/order/packaging/popup_content.phtml +++ b/vendor/magento/module-shipping/view/adminhtml/templates/order/packaging/popup_content.phtml @@ -30,7 +30,7 @@
- +
- + - + displayCustomsValue()): ?> + renderStyleAsTag('display: none', 'th.col-custom') ?> + - - - + + + - getDeliveryConfirmationTypes()) : ?> + getDeliveryConfirmationTypes()): ?> diff --git a/vendor/magento/module-dhl/Model/Carrier.php b/vendor/magento/module-dhl/Model/Carrier.php index 7ea0e670d0d..ba01acb0b3a 100644 --- a/vendor/magento/module-dhl/Model/Carrier.php +++ b/vendor/magento/module-dhl/Model/Carrier.php @@ -57,7 +57,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * * @var string[] */ - protected $_customizableContainerTypes = [self::DHL_CONTENT_TYPE_NON_DOC]; + protected $_customizableContainerTypes = [self::DHL_CONTENT_TYPE_NON_DOC, self::DHL_CONTENT_TYPE_DOC]; /** * Code of the carrier @@ -565,16 +565,16 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin if ($this->_isDomestic) { $allowedMethods = array_merge( - explode(',', $this->getConfigData('doc_methods')), - explode(',', $this->getConfigData('nondoc_methods')) + explode(',', $this->getConfigData('doc_methods') ?? ''), + explode(',', $this->getConfigData('nondoc_methods') ?? '') ); } else { switch ($contentType) { case self::DHL_CONTENT_TYPE_DOC: - $allowedMethods = explode(',', $this->getConfigData('doc_methods')); + $allowedMethods = explode(',', $this->getConfigData('doc_methods') ?? ''); break; case self::DHL_CONTENT_TYPE_NON_DOC: - $allowedMethods = explode(',', $this->getConfigData('nondoc_methods')); + $allowedMethods = explode(',', $this->getConfigData('nondoc_methods') ?? ''); break; default: throw new \Magento\Framework\Exception\LocalizedException(__('Wrong Content Type')); @@ -1404,6 +1404,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * @param \Magento\Framework\DataObject $request * @return $this|\Magento\Framework\DataObject|boolean * @deprecated 100.2.3 + * @see use processAdditionalValidation method instead */ public function proccessAdditionalValidation(\Magento\Framework\DataObject $request) { @@ -1522,6 +1523,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ + protected function _doRequest() { $rawRequest = $this->_request; @@ -1530,8 +1532,8 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin ''; + ' xsi:schemaLocation="http://www.dhl.com ship-val-global-req.xsd"' . + ' schemaVersion="10.0" />'; $xml = $this->_xmlElFactory->create(['data' => $xmlStr]); $nodeRequest = $xml->addChild('Request', '', ''); @@ -1545,6 +1547,10 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $nodeServiceHeader->addChild('SiteID', (string)$this->getConfigData('id')); $nodeServiceHeader->addChild('Password', (string)$this->getConfigData('password')); + $nodeMetaData = $nodeRequest->addChild('MetaData'); + $nodeMetaData->addChild('SoftwareName', $this->buildSoftwareName()); + $nodeMetaData->addChild('SoftwareVersion', $this->buildSoftwareVersion()); + $originRegion = $this->getCountryParams( $this->_scopeConfig->getValue( Shipment::XML_PATH_STORE_COUNTRY_ID, @@ -1556,13 +1562,11 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $xml->addChild('RegionCode', $originRegion, ''); } $xml->addChild('RequestedPickupTime', 'N', ''); - $xml->addChild('NewShipper', 'N', ''); $xml->addChild('LanguageCode', 'EN', ''); - $xml->addChild('PiecesEnabled', 'Y', ''); /** Billing */ $nodeBilling = $xml->addChild('Billing', '', ''); - $nodeBilling->addChild('ShipperAccountNumber', (string)$this->getConfigData('account')); + $nodeBilling->addChild('ShipperAccountNumber', (string)substr($this->getConfigData('account'), 0, 9)); /** * Method of Payment: * S (Shipper) @@ -1574,9 +1578,13 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin /** * Shipment bill to account – required if Shipping PaymentType is other than 'S' */ - $nodeBilling->addChild('BillingAccountNumber', (string)$this->getConfigData('account')); - $nodeBilling->addChild('DutyPaymentType', 'S'); - $nodeBilling->addChild('DutyAccountNumber', (string)$this->getConfigData('account')); + $nodeBilling->addChild('BillingAccountNumber', (string)substr($this->getConfigData('account'), 0, 9)); + if ($this->isDutiable( + $rawRequest->getShipperAddressCountryCode(), + $rawRequest->getRecipientAddressCountryCode() + )) { + $nodeBilling->addChild('DutyAccountNumber', (string)substr($this->getConfigData('account'), 0, 9)); + } /** Receiver */ $nodeConsignee = $xml->addChild('Consignee', '', ''); @@ -1585,16 +1593,21 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin ->getRecipientContactCompanyName() : $rawRequest ->getRecipientContactPersonName(); - $nodeConsignee->addChild('CompanyName', substr($companyName, 0, 35)); + $nodeConsignee->addChild('CompanyName', is_string($companyName) ? substr($companyName, 0, 60) : ''); $address = $rawRequest->getRecipientAddressStreet1() . ' ' . $rawRequest->getRecipientAddressStreet2(); - $address = $this->string->split($address, 35, false, true); + $address = $this->string->split($address, 45, false, true); if (is_array($address)) { + $addressLineNumber = 1; foreach ($address as $addressLine) { - $nodeConsignee->addChild('AddressLine', $addressLine); + if ($addressLineNumber > 3) { + break; + } + $nodeConsignee->addChild('AddressLine'.$addressLineNumber, $addressLine); + $addressLineNumber++; } } else { - $nodeConsignee->addChild('AddressLine', $address); + $nodeConsignee->addChild('AddressLine1', $address); } $nodeConsignee->addChild('City', $rawRequest->getRecipientAddressCity()); @@ -1622,7 +1635,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * value should lie in between 1 to 9999.This field is mandatory. */ $nodeCommodity = $xml->addChild('Commodity', '', ''); - $nodeCommodity->addChild('CommodityCode', '1'); + $nodeCommodity->addChild('CommodityCode', substr('01', 0, 18)); /** Dutiable */ if ($this->isDutiable( @@ -1636,6 +1649,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin ); $baseCurrencyCode = $this->_storeManager->getWebsite($rawRequest->getWebsiteId())->getBaseCurrencyCode(); $nodeDutiable->addChild('DeclaredCurrency', $baseCurrencyCode); + $nodeDutiable->addChild('TermsOfTrade', 'DAP'); } /** @@ -1652,18 +1666,23 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin /** Shipper */ $nodeShipper = $xml->addChild('Shipper', '', ''); - $nodeShipper->addChild('ShipperID', (string)$this->getConfigData('account')); + $nodeShipper->addChild('ShipperID', (string)substr($this->getConfigData('account'), 0, 9)); $nodeShipper->addChild('CompanyName', $rawRequest->getShipperContactCompanyName()); - $nodeShipper->addChild('RegisteredAccount', (string)$this->getConfigData('account')); + $nodeShipper->addChild('RegisteredAccount', (string)substr($this->getConfigData('account'), 0, 9)); $address = $rawRequest->getShipperAddressStreet1() . ' ' . $rawRequest->getShipperAddressStreet2(); - $address = $this->string->split($address, 35, false, true); + $address = $this->string->split($address, 45, false, true); if (is_array($address)) { + $addressLineNumber = 1; foreach ($address as $addressLine) { - $nodeShipper->addChild('AddressLine', $addressLine); + if ($addressLineNumber > 3) { + break; + } + $nodeShipper->addChild('AddressLine'.$addressLineNumber, $addressLine); + $addressLineNumber++; } } else { - $nodeShipper->addChild('AddressLine', $address); + $nodeShipper->addChild('AddressLine1', $address); } $nodeShipper->addChild('City', $rawRequest->getShipperAddressCity()); @@ -1714,7 +1733,6 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $this->_debug($debugData); } $this->_isShippingLabelFlag = true; - return $this->_parseResponse($responseBody); } @@ -1732,7 +1750,6 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin protected function _shipmentDetails($xml, $rawRequest, $originRegion = '') { $nodeShipmentDetails = $xml->addChild('ShipmentDetails', '', ''); - $nodeShipmentDetails->addChild('NumberOfPieces', count($rawRequest->getPackages())); $nodePieces = $nodeShipmentDetails->addChild('Pieces', '', ''); @@ -1766,7 +1783,6 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $nodePiece->addChild('PieceContents', substr(implode(',', $content), 0, 34)); } - $nodeShipmentDetails->addChild('Weight', sprintf('%.3f', $rawRequest->getPackageWeight())); $nodeShipmentDetails->addChild('WeightUnit', substr($this->_getWeightUnit(), 0, 1)); $nodeShipmentDetails->addChild('GlobalProductCode', $rawRequest->getShippingMethod()); $nodeShipmentDetails->addChild('LocalProductCode', $rawRequest->getShippingMethod()); @@ -1760,18 +1799,15 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $this->_coreDate->date('Y-m-d', strtotime('now + 1day')) ); $nodeShipmentDetails->addChild('Contents', 'DHL Parcel'); - /** - * The DoorTo Element defines the type of delivery service that applies to the shipment. - * The valid values are DD (Door to Door), DA (Door to Airport) , AA and DC (Door to - * Door non-compliant) - */ - $nodeShipmentDetails->addChild('DoorTo', 'DD'); + $nodeShipmentDetails->addChild('DimensionUnit', substr($this->_getDimensionUnit(), 0, 1)); - if ($package['params']['container'] == self::DHL_CONTENT_TYPE_NON_DOC) { - $packageType = 'CP'; - } + $contentType = isset($package['params']['container']) ? $package['params']['container'] : ''; + $packageType = $contentType === self::DHL_CONTENT_TYPE_NON_DOC ? 'CP' : 'EE'; $nodeShipmentDetails->addChild('PackageType', $packageType); - if ($this->isDutiable($rawRequest->getOrigCountryId(), $rawRequest->getDestCountryId())) { + if ($this->isDutiable( + $rawRequest->getShipperAddressCountryCode(), + $rawRequest->getRecipientAddressCountryCode() + )) { $nodeShipmentDetails->addChild('IsDutiable', 'Y'); } $nodeShipmentDetails->addChild( @@ -1940,7 +1954,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $shipmentEventArray['deliverydate'] = (string)$shipmentEvent->Date; $shipmentEventArray['deliverytime'] = (string)$shipmentEvent->Time; $shipmentEventArray['deliverylocation'] = (string)$shipmentEvent->ServiceArea - ->Description . ' [' . (string)$shipmentEvent->ServiceArea->ServiceAreaCode . ']'; + ->Description . ' [' . (string)$shipmentEvent->ServiceArea->ServiceAreaCode . ']'; $packageProgress[] = $shipmentEventArray; } $awbinfoData['progressdetail'] = $packageProgress; @@ -2026,10 +2062,10 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $origCountry = (string)$this->getCountryParams($origCountryCode)->getData('name'); $destCountry = (string)$this->getCountryParams($destCountryCode)->getData('name'); - $isDomestic = (string)$this->getCountryParams($destCountryCode)->getData('domestic'); - if (($origCountry == $destCountry && $isDomestic) - || ($this->_carrierHelper->isCountryInEU($origCountryCode) + if (($origCountry == $destCountry) + || ( + $this->_carrierHelper->isCountryInEU($origCountryCode) && $this->_carrierHelper->isCountryInEU($destCountryCode) ) ) {
escapeHtml(__('Type')) ?> escapeHtml(__('Size')) ?> escapeHtml(__('Girth')) ?>   displayCustomsValue() ? '' : 'style="display: none;"' ?>> + escapeHtml(__('Customs Value')) ?> escapeHtml(__('Total Weight')) ?>escapeHtml(__('Length')) ?>escapeHtml(__('Width')) ?>escapeHtml(__('Height')) ?>escapeHtml(__('Length')) ?>escapeHtml(__('Width')) ?>escapeHtml(__('Height')) ?>  escapeHtml(__('Signature Confirmation')) ?>