Skip to content

Commit bdf967d

Browse files
authored
Merge branch '2.4-develop' into update-whishlist-graphql-readme
2 parents c95fee9 + 63434d2 commit bdf967d

File tree

376 files changed

+10367
-1400
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

376 files changed

+10367
-1400
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ indent_size = 2
1616

1717
[{composer, auth}.json]
1818
indent_size = 4
19+
20+
[db_schema_whitelist.json]
21+
indent_size = 4
22+
trim_trailing_whitespace = false
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="AssertLinkActionGroup">
12+
<annotations>
13+
<description>Assert text and url of the links.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="text" type="string"/>
17+
<argument name="url" type="string"/>
18+
</arguments>
19+
20+
<seeLink userInput="{{text}}" url="{{url}}" stepKey="assertLinks"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/Backend/Test/Mftf/Test/AdminPrivacyPolicyTest.xml

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,70 +23,91 @@
2323
<!-- Logging in Magento admin and checking for Privacy policy footer in dashboard -->
2424
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
2525
<closeAdminNotification stepKey="closeAdminNotification"/>
26-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkDashboard"/>
27-
26+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkDashboard">
27+
<argument name="text" value="Privacy Policy"/>
28+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
29+
</actionGroup>
2830
<!-- Checking for Privacy policy footer in salesOrderPage -->
2931
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSalesOrder">
3032
<argument name="menuUiId" value="magento-sales-sales"/>
3133
<argument name="submenuUiId" value="magento-sales-sales-order"/>
3234
</actionGroup>
33-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkSalesOrder"/>
34-
35+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkSalesOrder">
36+
<argument name="text" value="Privacy Policy"/>
37+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
38+
</actionGroup>
3539
<!-- Checking for Privacy policy footer in catalogProductsPage -->
3640
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToCatalogProducts">
3741
<argument name="menuUiId" value="magento-catalog-catalog"/>
3842
<argument name="submenuUiId" value="magento-catalog-catalog-products"/>
3943
</actionGroup>
40-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkCatalogProducts"/>
41-
44+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkCatalogProducts">
45+
<argument name="text" value="Privacy Policy"/>
46+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
47+
</actionGroup>
4248
<!-- Checking for Privacy policy footer in customersAllCustomersPage -->
4349
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToCustomersAllCustomers">
4450
<argument name="menuUiId" value="magento-customer-customer"/>
4551
<argument name="submenuUiId" value="magento-customer-customer-manage"/>
4652
</actionGroup>
47-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkCustomersAllCustomers"/>
48-
53+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkCustomersAllCustomers">
54+
<argument name="text" value="Privacy Policy"/>
55+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
56+
</actionGroup>
4957
<!-- Checking for Privacy policy footer in marketingCatalogPriceRulePage -->
5058
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToMarketingCatalogPriceRule">
5159
<argument name="menuUiId" value="magento-backend-marketing"/>
5260
<argument name="submenuUiId" value="magento-catalogrule-promo-catalog"/>
5361
</actionGroup>
54-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkMarketingCatalogPriceRule"/>
55-
62+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkMarketingCatalogPriceRule">
63+
<argument name="text" value="Privacy Policy"/>
64+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
65+
</actionGroup>
5666
<!-- Checking for Privacy policy footer in contentBlocksPage -->
5767
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToContentBlocks">
5868
<argument name="menuUiId" value="magento-backend-content"/>
5969
<argument name="submenuUiId" value="magento-cms-cms-block"/>
6070
</actionGroup>
61-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkContentBlocks"/>
62-
71+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkContentBlocks">
72+
<argument name="text" value="Privacy Policy"/>
73+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
74+
</actionGroup>
6375
<!-- Checking for Privacy policy footer in reportSearcbTermsPage -->
6476
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsSearchTerms">
6577
<argument name="menuUiId" value="magento-reports-report"/>
6678
<argument name="submenuUiId" value="magento-search-report-search-term"/>
6779
</actionGroup>
68-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkReportsSearchTerms"/>
69-
80+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkReportsSearchTerms">
81+
<argument name="text" value="Privacy Policy"/>
82+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
83+
</actionGroup>
7084
<!-- Checking for Privacy policy footer in storesAllStoresPage -->
7185
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToStoresAllStores">
7286
<argument name="menuUiId" value="magento-backend-stores"/>
7387
<argument name="submenuUiId" value="magento-backend-system-store"/>
7488
</actionGroup>
75-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkStoresAllStores"/>
76-
89+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkStoresAllStores">
90+
<argument name="text" value="Privacy Policy"/>
91+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
92+
</actionGroup>
7793
<!-- Checking for Privacy policy footer in systemImportPage -->
7894
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSystemImport">
7995
<argument name="menuUiId" value="magento-backend-system"/>
8096
<argument name="submenuUiId" value="magento-importexport-system-convert-import"/>
8197
</actionGroup>
82-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkSystemImport"/>
83-
98+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkSystemImport">
99+
<argument name="text" value="Privacy Policy"/>
100+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
101+
</actionGroup>
84102
<!-- Checking for Privacy policy footer in findPartnersAndExtensionsPage -->
85103
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToFindPartnersAndExtensions">
86104
<argument name="menuUiId" value="magento-marketplace-partners"/>
87105
<argument name="submenuUiId" value="magento-marketplace-partners"/>
88106
</actionGroup>
89-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkFindPartnersAndExtensions"/>
107+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkFindPartnersAndExtensions">
108+
<argument name="text" value="Privacy Policy"/>
109+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
110+
</actionGroup>
90111
</test>
91112
</tests>
92113

app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
* getPagerVisibility()
1515
* getVarNamePage()
1616
*/
17-
$numColumns = count($block->getColumns());
1817

1918
/**
2019
* @var \Magento\Backend\Block\Widget\Grid\Extended $block
2120
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
2221
*/
22+
$numColumns = count($block->getColumns());
23+
2324
?>
2425
<?php if ($block->getCollection()): ?>
2526
<?php if ($block->canDisplayContainer()): ?>
@@ -285,7 +286,9 @@ $numColumns = count($block->getColumns());
285286
</table>
286287

287288
</div>
289+
<?php if ($block->canDisplayContainer()): ?>
288290
</div>
291+
<?php endif; ?>
289292
<?php
290293
/** @var \Magento\Framework\Json\Helper\Data $jsonHelper */
291294
$jsonHelper = $block->getData('jsonHelper');

app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php

Lines changed: 107 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\Bundle\Model\Sales\Order\Pdf\Items;
99

1010
use Magento\Framework\Data\Collection\AbstractDb;
11+
use Magento\Framework\DataObject;
1112
use Magento\Framework\Filesystem;
1213
use Magento\Framework\Filter\FilterManager;
1314
use Magento\Framework\Model\Context;
@@ -69,50 +70,52 @@ public function __construct(
6970
}
7071

7172
/**
72-
* Draw item line
73+
* Draw bundle product item line
7374
*
7475
* @return void
75-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
76-
* @SuppressWarnings(PHPMD.NPathComplexity)
77-
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
7876
*/
7977
public function draw()
8078
{
81-
$order = $this->getOrder();
82-
$item = $this->getItem();
83-
$pdf = $this->getPdf();
84-
$page = $this->getPage();
79+
$draw = $this->drawChildrenItems();
80+
$draw = $this->drawCustomOptions($draw);
8581

82+
$page = $this->getPdf()->drawLineBlocks($this->getPage(), $draw, ['table_header' => true]);
83+
84+
$this->setPage($page);
85+
}
86+
87+
/**
88+
* Draw bundle product children items
89+
*
90+
* @return array
91+
*/
92+
private function drawChildrenItems(): array
93+
{
8694
$this->_setFontRegular();
87-
$items = $this->getChildren($item);
8895

8996
$prevOptionId = '';
9097
$drawItems = [];
91-
92-
foreach ($items as $childItem) {
93-
$line = [];
94-
98+
$optionId = 0;
99+
$lines = [];
100+
foreach ($this->getChildren($this->getItem()) as $childItem) {
101+
$index = array_key_last($lines) !== null ? array_key_last($lines) + 1 : 0;
95102
$attributes = $this->getSelectionAttributes($childItem);
96103
if (is_array($attributes)) {
97104
$optionId = $attributes['option_id'];
98-
} else {
99-
$optionId = 0;
100105
}
101106

102107
if (!isset($drawItems[$optionId])) {
103108
$drawItems[$optionId] = ['lines' => [], 'height' => 15];
104109
}
105110

106111
if ($childItem->getOrderItem()->getParentItem() && $prevOptionId != $attributes['option_id']) {
107-
$line[0] = [
112+
$lines[$index][] = [
108113
'font' => 'italic',
109114
'text' => $this->string->split($attributes['option_label'], 45, true, true),
110115
'feed' => 35,
111116
];
112117

113-
$drawItems[$optionId] = ['lines' => [$line], 'height' => 15];
114-
115-
$line = [];
118+
$index++;
116119
$prevOptionId = $attributes['option_id'];
117120
}
118121

@@ -124,35 +127,97 @@ public function draw()
124127
$feed = 35;
125128
$name = $childItem->getName();
126129
}
127-
$line[] = ['text' => $this->string->split($name, 35, true, true), 'feed' => $feed];
130+
$lines[$index][] = ['text' => $this->string->split($name, 35, true, true), 'feed' => $feed];
128131

129-
// draw SKUs
130-
if (!$childItem->getOrderItem()->getParentItem()) {
131-
$text = [];
132-
foreach ($this->string->split($item->getSku(), 17) as $part) {
133-
$text[] = $part;
134-
}
135-
$line[] = ['text' => $text, 'feed' => 255];
136-
}
132+
$lines = $this->drawSkus($childItem, $lines);
137133

138-
// draw prices
139-
if ($this->canShowPriceInfo($childItem)) {
140-
$price = $order->formatPriceTxt($childItem->getPrice());
141-
$line[] = ['text' => $price, 'feed' => 395, 'font' => 'bold', 'align' => 'right'];
142-
$line[] = ['text' => $childItem->getQty() * 1, 'feed' => 435, 'font' => 'bold'];
134+
$lines = $this->drawPrices($childItem, $lines);
135+
}
136+
$drawItems[$optionId]['lines'] = $lines;
143137

144-
$tax = $order->formatPriceTxt($childItem->getTaxAmount());
145-
$line[] = ['text' => $tax, 'feed' => 495, 'font' => 'bold', 'align' => 'right'];
138+
return $drawItems;
139+
}
146140

147-
$row_total = $order->formatPriceTxt($childItem->getRowTotal());
148-
$line[] = ['text' => $row_total, 'feed' => 565, 'font' => 'bold', 'align' => 'right'];
141+
/**
142+
* Draw sku parts
143+
*
144+
* @param DataObject $childItem
145+
* @param array $lines
146+
* @return array
147+
*/
148+
private function drawSkus(DataObject $childItem, array $lines): array
149+
{
150+
$index = array_key_last($lines);
151+
if (!$childItem->getOrderItem()->getParentItem()) {
152+
$text = [];
153+
foreach ($this->string->split($this->getItem()->getSku(), 17) as $part) {
154+
$text[] = $part;
149155
}
156+
$lines[$index][] = ['text' => $text, 'feed' => 255];
157+
}
158+
159+
return $lines;
160+
}
150161

151-
$drawItems[$optionId]['lines'][] = $line;
162+
/**
163+
* Draw prices for bundle product children items
164+
*
165+
* @param DataObject $childItem
166+
* @param array $lines
167+
* @return array
168+
*/
169+
private function drawPrices(DataObject $childItem, array $lines): array
170+
{
171+
$index = array_key_last($lines);
172+
if ($this->canShowPriceInfo($childItem)) {
173+
$lines[$index][] = ['text' => $childItem->getQty() * 1, 'feed' => 435, 'align' => 'right'];
174+
175+
$tax = $this->getOrder()->formatPriceTxt($childItem->getTaxAmount());
176+
$lines[$index][] = ['text' => $tax, 'feed' => 495, 'font' => 'bold', 'align' => 'right'];
177+
178+
$item = $this->getItem();
179+
$this->_item = $childItem;
180+
$feedPrice = 380;
181+
$feedSubtotal = $feedPrice + 185;
182+
foreach ($this->getItemPricesForDisplay() as $priceData) {
183+
if (isset($priceData['label'])) {
184+
// draw Price label
185+
$lines[$index][] = ['text' => $priceData['label'], 'feed' => $feedPrice, 'align' => 'right'];
186+
// draw Subtotal label
187+
$lines[$index][] = ['text' => $priceData['label'], 'feed' => $feedSubtotal, 'align' => 'right'];
188+
$index++;
189+
}
190+
// draw Price
191+
$lines[$index][] = [
192+
'text' => $priceData['price'],
193+
'feed' => $feedPrice,
194+
'font' => 'bold',
195+
'align' => 'right',
196+
];
197+
// draw Subtotal
198+
$lines[$index][] = [
199+
'text' => $priceData['subtotal'],
200+
'feed' => $feedSubtotal,
201+
'font' => 'bold',
202+
'align' => 'right',
203+
];
204+
$index++;
205+
}
206+
$this->_item = $item;
152207
}
153208

154-
// custom options
155-
$options = $item->getOrderItem()->getProductOptions();
209+
return $lines;
210+
}
211+
212+
/**
213+
* Draw bundle product custom options
214+
*
215+
* @param array $draw
216+
* @return array
217+
*/
218+
private function drawCustomOptions(array $draw): array
219+
{
220+
$options = $this->getItem()->getOrderItem()->getProductOptions();
156221
if ($options && isset($options['options'])) {
157222
foreach ($options['options'] as $option) {
158223
$lines = [];
@@ -180,12 +245,10 @@ public function draw()
180245
$lines[][] = ['text' => $text, 'feed' => 40];
181246
}
182247

183-
$drawItems[] = ['lines' => $lines, 'height' => 15];
248+
$draw[] = ['lines' => $lines, 'height' => 15];
184249
}
185250
}
186251

187-
$page = $pdf->drawLineBlocks($page, $drawItems, ['table_header' => true]);
188-
189-
$this->setPage($page);
252+
return $draw;
190253
}
191254
}

app/code/Magento/Bundle/Pricing/Price/BundleSelectionFactory.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ public function create(
5252
$quantity,
5353
array $arguments = []
5454
) {
55+
$quantity = $quantity ? (float)$quantity : 1.;
56+
$selection->setQty($quantity);
57+
5558
$arguments['bundleProduct'] = $bundleProduct;
5659
$arguments['saleableItem'] = $selection;
57-
$arguments['quantity'] = $quantity ? (float)$quantity : 1.;
60+
$arguments['quantity'] = $quantity;
5861

5962
return $this->objectManager->create(self::SELECTION_CLASS_DEFAULT, $arguments);
6063
}

0 commit comments

Comments
 (0)