Skip to content

Commit d693595

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into MC-36048
2 parents 0b14dc6 + 6cb92ae commit d693595

File tree

9 files changed

+172
-105
lines changed

9 files changed

+172
-105
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontGoToCustomerOrderDetailsPageActionGroup">
12+
<annotations>
13+
<description>Navigate to storefront order details page</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="orderId" type="string"/>
17+
<argument name="orderNumber" type="string"/>
18+
</arguments>
19+
<amOnPage url="{{StorefrontCustomerOrderViewPage.url(orderId)}}" stepKey="goToOrdersPage"/>
20+
<waitForPageLoad stepKey="waitForPageLoad"/>
21+
<waitForText selector="{{StorefrontCustomerAccountMainSection.pageTitle}}" userInput="{{orderNumber}}" stepKey="verifyOrderNo"/>
22+
</actionGroup>
23+
</actionGroups>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontVerifyCustomerOrderDataActionGroup">
12+
<annotations>
13+
<description>Verify a customer's order details on the view order page on the storefront</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="createdDate" type="string"/>
17+
<argument name="productName" type="string"/>
18+
<argument name="grandTotal" type="string"/>
19+
<argument name="orderPlacedBy" type="string"/>
20+
<argument name="paymentMethod" type="string"/>
21+
</arguments>
22+
<waitForText selector="{{StorefrontCustomerOrderViewSection.paymentMethod}}" userInput="{{paymentMethod}}" stepKey="storefrontVerifyPaymentMethod"/>
23+
<waitForText selector="{{StorefrontCustomerOrderViewSection.createdDate}}" userInput="{{createdDate}}" stepKey="storefrontVerifyOrderCreatedDate"/>
24+
<waitForText selector="{{StorefrontCustomerOrderViewSection.orderPlacedBy}}" userInput="{{orderPlacedBy}}" stepKey="storefrontVerifyOrderPlacedBy"/>
25+
<waitForText selector="{{StorefrontCustomerOrderViewSection.productName}}" userInput="{{productName}}" stepKey="storefrontVerifyProductName"/>
26+
<waitForText selector="{{StorefrontCustomerOrderViewSection.grandTotal}}" userInput="{{grandTotal}}" stepKey="storefrontVerifyGrandTotal"/>
27+
28+
</actionGroup>
29+
</actionGroups>

app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerOrderViewSection.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,9 @@
1818
<element name="billingAddress" type="text" selector=".box.box-order-billing-address"/>
1919
<element name="orderStatusInGrid" type="text" selector="//td[contains(.,'{{orderId}}')]/../td[contains(.,'{{status}}')]" parameterized="true"/>
2020
<element name="pager" type="block" selector=".pager"/>
21+
<element name="createdDate" type="text" selector=".block-order-details-comments .comment-date"/>
22+
<element name="orderPlacedBy" type="text" selector=".block-order-details-comments .comment-content"/>
23+
<element name="productName" type="text" selector="//td[@data-th='Product Name']"/>
24+
<element name="grandTotal" type="text" selector="//tr[@class='grand_total']//td[@data-th='Grand Total']"/>
2125
</section>
2226
</sections>

app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
<severity value="BLOCKER"/>
1818
<testCaseId value="MC-16161"/>
1919
<group value="mtf_migrated"/>
20-
<skip>
21-
<issueId value="MC-36044"/>
22-
</skip>
2320
</annotations>
2421

2522
<before>

app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ define([
8484
}, 10);
8585
};
8686

87-
if (jQuery('#' + this.getAreaId('items')).is(':visible')) {
87+
jQuery.async('#order-items .admin__page-section-title', (function () {
8888
this.dataArea.onLoad = this.dataArea.onLoad.wrap(function (proceed) {
8989
proceed();
9090
this._parent.itemsArea.setNode($(this._parent.getAreaId('items')));
@@ -99,7 +99,9 @@ define([
9999
});
100100
this.areasLoaded();
101101
this.itemsArea.onLoad();
102-
}
102+
103+
}).bind(this));
104+
103105
}).bind(this));
104106

105107
jQuery('#edit_form')

app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Shipping\Block\Adminhtml\Order;
78

9+
use Magento\Framework\App\ObjectManager;
10+
use Magento\Shipping\Helper\Carrier;
11+
812
/**
913
* Adminhtml shipment packaging
1014
*
@@ -44,19 +48,22 @@ class Packaging extends \Magento\Backend\Block\Template
4448
* @param \Magento\Framework\Registry $coreRegistry
4549
* @param \Magento\Shipping\Model\CarrierFactory $carrierFactory
4650
* @param array $data
51+
* @param Carrier|null $carrierHelper
4752
*/
4853
public function __construct(
4954
\Magento\Backend\Block\Template\Context $context,
5055
\Magento\Framework\Json\EncoderInterface $jsonEncoder,
5156
\Magento\Shipping\Model\Carrier\Source\GenericInterface $sourceSizeModel,
5257
\Magento\Framework\Registry $coreRegistry,
5358
\Magento\Shipping\Model\CarrierFactory $carrierFactory,
54-
array $data = []
59+
array $data = [],
60+
?Carrier $carrierHelper = null
5561
) {
5662
$this->_jsonEncoder = $jsonEncoder;
5763
$this->_coreRegistry = $coreRegistry;
5864
$this->_sourceSizeModel = $sourceSizeModel;
5965
$this->_carrierFactory = $carrierFactory;
66+
$data['carrierHelper'] = $carrierHelper ?? ObjectManager::getInstance()->get(Carrier::class);
6067
parent::__construct($context, $data);
6168
}
6269

app/code/Magento/Shipping/view/adminhtml/templates/create/items.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@
7777
name="shipment[create_shipping_label]"
7878
value="1"
7979
type="checkbox"/>
80+
<label class="admin__field-label"
81+
for="create_shipping_label">
82+
<span><?= $block->escapeHtml(__('Create Shipping Label')) ?></span></label>
8083
<?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
8184
'onclick',
8285
'toggleCreateLabelCheckbox();',
8386
'input#create_shipping_label'
8487
) ?>
85-
<label class="admin__field-label"
86-
for="create_shipping_label">
87-
<span><?= $block->escapeHtml(__('Create Shipping Label')) ?></span></label>
8888
</div>
8989
<?php endif ?>
9090

app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/grid.phtml

Lines changed: 60 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,48 @@
44
* See COPYING.txt for license details.
55
*/
66
//phpcs:disable Squiz.PHP.NonExecutableCode.Unreachable
7-
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
7+
/**
8+
* @var \Magento\Shipping\Block\Adminhtml\Order\Packaging $block
9+
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
10+
*/
811
?>
912
<div class="grid">
1013
<?php $randomId = rand(); ?>
1114
<div class="admin__table-wrapper">
12-
<table class="data-grid">
15+
<table id="packaging-data-grid-<?= /* @noEscape */ $randomId ?>" class="data-grid">
1316
<thead>
14-
<tr>
15-
<th class="data-grid-checkbox-cell">
16-
<label class="data-grid-checkbox-cell-inner">
17-
<input type="checkbox"
18-
id="select-items-<?= /* @noEscape */ $randomId ?>"
19-
class="checkbox admin__control-checkbox"
20-
title="<?= $block->escapeHtmlAttr(__('Select All')) ?>">
21-
<?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
22-
'onchange',
23-
'packaging.checkAllItems(this);',
24-
'input#select-items-' . /* @noEscape */ $randomId
25-
) ?>
26-
<label for="select-items-<?= /* @noEscape */ $randomId ?>"></label>
27-
</label>
28-
</th>
29-
<th class="data-grid-th"><?= $block->escapeHtml(__('Product Name')) ?></th>
30-
<th class="data-grid-th"><?= $block->escapeHtml(__('Weight')) ?></th>
31-
<th class="data-grid-th custom-value">
32-
<?= $block->escapeHtml(__('Customs Value')) ?>
33-
</th>
34-
<?php if (!$block->displayCustomsValue()): ?>
35-
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag('display: none;', 'th.custom-value') ?>
36-
<?php endif ?>
37-
<th class="data-grid-th"><?= $block->escapeHtml(__('Qty Ordered')) ?></th>
38-
<th class="data-grid-th"><?= $block->escapeHtml(__('Qty')) ?></th>
39-
</tr>
17+
<tr>
18+
<th class="data-grid-checkbox-cell">
19+
<label class="data-grid-checkbox-cell-inner">
20+
<input type="checkbox"
21+
id="select-items-<?= /* @noEscape */ $randomId ?>"
22+
class="checkbox admin__control-checkbox"
23+
title="<?= $block->escapeHtmlAttr(__('Select All')) ?>">
24+
<?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
25+
'onchange',
26+
'packaging.checkAllItems(this);',
27+
'input#select-items-' . /* @noEscape */ $randomId
28+
) ?>
29+
<label for="select-items-<?= /* @noEscape */ $randomId ?>"></label>
30+
</label>
31+
</th>
32+
<th class="data-grid-th"><?= $block->escapeHtml(__('Product Name')) ?></th>
33+
<th class="data-grid-th"><?= $block->escapeHtml(__('Weight')) ?></th>
34+
<th class="data-grid-th custom-value">
35+
<?= $block->escapeHtml(__('Customs Value')) ?>
36+
</th>
37+
<?php if (!$block->displayCustomsValue()): ?>
38+
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
39+
'display:none',
40+
'#packaging-data-grid-' . $randomId . ' th.custom-value'
41+
) ?>
42+
<?php endif ?>
43+
<th class="data-grid-th"><?= $block->escapeHtml(__('Qty Ordered')) ?></th>
44+
<th class="data-grid-th"><?= $block->escapeHtml(__('Qty')) ?></th>
45+
</tr>
4046
</thead>
4147
<tbody>
42-
<?php $i=0; ?>
48+
<?php $i = 0; ?>
4349
<?php foreach ($block->getCollection() as $item): ?>
4450
<?php
4551
$_order = $block->getShipment()->getOrder();
@@ -54,12 +60,12 @@
5460
<?php endif; ?>
5561
<tr class="data-grid-controls-row data-row <?= ($i++ % 2 != 0) ? '_odd-row' : '' ?>">
5662
<td class="data-grid-checkbox-cell">
57-
<?php $id = $item->getId() ? $item->getId() : $item->getOrderItemId(); ?>
63+
<?php $id = $item->getId() ?? $item->getOrderItemId(); ?>
5864
<label class="data-grid-checkbox-cell-inner">
5965
<input type="checkbox"
6066
name=""
6167
id="select-item-<?= /* @noEscape */ $randomId . '-' . $id ?>"
62-
value="<?= (int) $id ?>"
68+
value="<?= (int)$id ?>"
6369
class="checkbox admin__control-checkbox">
6470
<label for="select-item-<?= /* @noEscape */ $randomId . '-' . $id ?>"></label>
6571
</label>
@@ -78,47 +84,55 @@
7884
}
7985

8086
?>
81-
<td class="custom-value">
87+
<td id="custom-value-<?= /* @noEscape */ $randomId . '-' . $id ?>" class="custom-value">
8288
<input type="text"
8389
name="customs_value"
8490
class="input-text admin__control-text <?= /* @noEscape */ $customsValueValidation ?>"
8591
value="<?= $block->escapeHtmlAttr($block->formatPrice($item->getPrice())) ?>"
8692
size="10">
8793
</td>
88-
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag('display: none;', 'td.custom-value') ?>
89-
<?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
90-
'onblur',
91-
'packaging.recalcContainerWeightAndCustomsValue(this);',
92-
'td.custom-value'
93-
) ?>
94+
<?php if (!$block->displayCustomsValue()): ?>
95+
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
96+
'display:none',
97+
'td#custom-value-' . $randomId . '-' . $id
98+
) ?>
99+
<?php endif ?>
94100
<td>
95-
<?= /* @noEscape */ $item->getOrderItem()->getQtyOrdered()*1 ?>
101+
<?= /* @noEscape */ $item->getOrderItem()->getQtyOrdered() * 1 ?>
96102
</td>
97103
<td>
98104
<input type="hidden" name="price" value="<?= $block->escapeHtml($item->getPrice()) ?>">
99105
<input type="text"
100106
name="qty"
101-
value="<?= /* @noEscape */ $item->getQty()*1 ?>"
107+
value="<?= /* @noEscape */ $item->getQty() * 1 ?>"
102108
class="input-text admin__control-text qty
103109
<?php if ($item->getOrderItem()->getIsQtyDecimal()): ?>
104110
qty-decimal
105111
<?php endif ?>">&nbsp;
106112
<button type="button"
107-
id="packaging-delete-item-<?= /* @noEscape */ $item->getId() ?>"
113+
id="packaging-delete-item-<?= /* @noEscape */ $randomId . '-' . $id ?>"
108114
class="action-delete"
109115
data-action="package-delete-item">
110116
<span><?= $block->escapeHtml(__('Delete')) ?></span>
111117
</button>
112-
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag('display:none', 'button.action-delete') ?>
113-
<?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
114-
'onclick',
115-
'packaging.deleteItem(this);',
116-
'button#packaging-delete-item-' . $item->getId()
118+
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
119+
'display:none',
120+
'button#packaging-delete-item-' . $randomId . '-' . $id
117121
) ?>
118122
</td>
119123
</tr>
120124
<?php endforeach; ?>
121125
</tbody>
122126
</table>
127+
<?php $scriptString = <<<script
128+
require(['jquery'], function ($) {
129+
$("#packaging-data-grid-{$randomId}").on('blur', 'td.custom-value input',
130+
function(){packaging.recalcContainerWeightAndCustomsValue(this)});
131+
$("#packaging-data-grid-{$randomId}").on('click', 'button[data-action="package-delete-item"]',
132+
function(){packaging.deleteItem(this)});
133+
});
134+
script;
135+
?>
136+
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
123137
</div>
124138
</div>

0 commit comments

Comments
 (0)