Skip to content

Commit 27bde62

Browse files
authored
Merge pull request #2121 from magento-gl/2.4-develop
Sync 2.4-develop into AC-14075
2 parents 6093edc + 33fd6ee commit 27bde62

File tree

143 files changed

+5370
-1051
lines changed

Some content is hidden

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

143 files changed

+5370
-1051
lines changed

.github/app-projects-boards-automation.config.yaml

Lines changed: 402 additions & 0 deletions
Large diffs are not rendered by default.

app/code/Magento/Backend/App/Area/FrontNameResolver.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ public function getFrontName($checkHost = false)
117117
/**
118118
* Return whether the host from request is the backend host
119119
*
120+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
121+
* @SuppressWarnings(PHPMD.NPathComplexity)
122+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
120123
* @return bool
121124
*/
122125
public function isHostBackend()
@@ -128,10 +131,11 @@ public function isHostBackend()
128131
if ($this->scopeConfig->getValue(self::XML_PATH_USE_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE)) {
129132
$backendUrl = $this->scopeConfig->getValue(self::XML_PATH_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE);
130133
} else {
131-
$backendUrl = $this->config->getValue(Store::XML_PATH_UNSECURE_BASE_URL);
134+
$xmlPath = $this->request->isSecure() ? Store::XML_PATH_SECURE_BASE_URL : Store::XML_PATH_UNSECURE_BASE_URL;
135+
$backendUrl = $this->config->getValue($xmlPath);
132136
if ($backendUrl === null) {
133137
$backendUrl = $this->scopeConfig->getValue(
134-
Store::XML_PATH_UNSECURE_BASE_URL,
138+
$xmlPath,
135139
ScopeInterface::SCOPE_STORE
136140
);
137141
}

app/code/Magento/Backend/Test/Unit/App/Area/FrontNameResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public function testIsHostBackend(
129129
->willReturnMap(
130130
[
131131
[Store::XML_PATH_UNSECURE_BASE_URL, ScopeInterface::SCOPE_STORE, null, $url],
132+
[Store::XML_PATH_SECURE_BASE_URL, ScopeInterface::SCOPE_STORE, null, $url],
132133
[
133134
FrontNameResolver::XML_PATH_USE_CUSTOM_ADMIN_URL,
134135
ScopeInterface::SCOPE_STORE,
@@ -160,7 +161,6 @@ public function testIsHostBackend(
160161
->setHost(parse_url($url, PHP_URL_HOST))
161162
->setPort(parse_url($url, PHP_URL_PORT))
162163
);
163-
164164
$this->assertEquals($expectedValue, $this->model->isHostBackend());
165165
}
166166

app/code/Magento/Bundle/Test/Mftf/Section/StorefrontBundleProductActionSection.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright 2024 Adobe
4+
* Copyright 2025 Adobe
55
* All Rights Reserved.
66
*/
77
-->
@@ -14,6 +14,6 @@
1414
<element name="dropdownSelectOption" type="select" selector="//div[@class='control']/select"/>
1515
<element name="dropdownProductSelection" type="select" selector="//div[@class='control']/select/option[contains(.,'{{productName}}')]" parameterized="true"/>
1616
<element name="customOptionField" type="select" selector="[class='input-text product-custom-option']"/>
17-
<element name="bundleOption" type="text" selector="//*[@id='product-options-wrapper']//div[@class='control']//span[text()='{{productName}}']" parameterized="true"/>
17+
<element name="bundleOption" type="text" selector="//select[contains(@class, 'bundle-option')]/option[contains(text(),'{{productName}}')]" parameterized="true"/>
1818
</section>
1919
</sections>

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
*
43
* Copyright 2024 Adobe
54
* All Rights Reserved.
65
*/
@@ -272,6 +271,16 @@ public function execute()
272271
if (array_key_exists('reset_is-default_option', $data) && $data['reset_is-default_option']) {
273272
unset($data['reset_is-default_option']);
274273
$data['default_value'] = null;
274+
} elseif (isset($data['default'])) {
275+
$defaultOptions = [];
276+
foreach ($data['default'] as $defaultValue) {
277+
if ((int)$defaultValue > 0) {
278+
$defaultOptions[] = $defaultValue;
279+
}
280+
}
281+
if (!empty($defaultOptions)) {
282+
$data['default_value'] = implode(",", $defaultOptions);
283+
}
275284
}
276285

277286
$model->addData($data);

app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateNewProductAttributeSection.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
6-
*/
3+
/**
4+
* Copyright 2019 Adobe
5+
* All Rights Reserved.
6+
*/
77
-->
88

99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -19,7 +19,7 @@
1919
<element name="secondOptionStoreView" type="input" selector="//td[@class='col-option_1'][3]/input"/>
2020
<element name="customStoreViewField" type="input" selector="input[value='{{fieldValue}}']" parameterized="true"/>
2121
<element name="adminOption" type="input" selector="//input[contains(@name,'option[value][option_{{row}}][0]')]" parameterized="true"/>
22-
<element name="defaultRadioButton" type="radio" selector="//tr[{{row}}]//input[contains(@name,'default[]')]" parameterized="true"/>
22+
<element name="defaultRadioButton" type="radio" selector="//tr[{{row}}]//input[contains(@name,'default[')]" parameterized="true"/>
2323
<element name="isRequired" type="checkbox" selector="//input[contains(@name,'is_required')]/..//label"/>
2424
<element name="advancedAttributeProperties" type="text" selector="//div[contains(@data-index,'advanced_fieldset')]"/>
2525
<element name="attributeCode" type="input" selector="//*[@class='admin__fieldset-wrapper-content admin__collapsible-content _show']//input[@name='attribute_code']"/>

app/code/Magento/Catalog/Test/Mftf/Test/CreateProductAttributeEntityTest/CreateProductAttributeEntityMultiSelectTest.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
6-
*/
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
6+
*/
77
-->
88
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
@@ -53,7 +53,7 @@
5353
<argument name="frontName" value="{{multiselectProductAttribute.option1_frontend}}"/>
5454
<argument name="row" value="1"/>
5555
</actionGroup>
56-
<actionGroup ref="CreateAttributeDropdownNthOptionActionGroup" stepKey="createOption2">
56+
<actionGroup ref="CreateAttributeDropdownNthOptionAsDefaultActionGroup" stepKey="createOption2">
5757
<argument name="adminName" value="{{multiselectProductAttribute.option2_admin}}"/>
5858
<argument name="frontName" value="{{multiselectProductAttribute.option2_frontend}}"/>
5959
<argument name="row" value="2"/>
@@ -80,7 +80,7 @@
8080
<dontSeeCheckboxIsChecked stepKey="dontSeeOption1Default" selector="{{AttributePropertiesSection.dropdownNthOptionIsDefault('1')}}"/>
8181
<seeInField stepKey="seeOption2Admin" selector="{{AttributePropertiesSection.dropdownNthOptionAdmin('2')}}" userInput="{{multiselectProductAttribute.option2_admin}}"/>
8282
<seeInField stepKey="seeOption2StoreView" selector="{{AttributePropertiesSection.dropdownNthOptionDefaultStoreView('2')}}" userInput="{{multiselectProductAttribute.option2_frontend}}"/>
83-
<dontSeeCheckboxIsChecked stepKey="dontSeeOption2Default" selector="{{AttributePropertiesSection.dropdownNthOptionIsDefault('2')}}"/>
83+
<seeCheckboxIsChecked stepKey="dontSeeOption2Default" selector="{{AttributePropertiesSection.dropdownNthOptionIsDefault('2')}}"/>
8484
<seeInField stepKey="seeOption3Admin" selector="{{AttributePropertiesSection.dropdownNthOptionAdmin('3')}}" userInput="{{multiselectProductAttribute.option3_admin}}"/>
8585
<seeInField stepKey="seeOption3StoreView" selector="{{AttributePropertiesSection.dropdownNthOptionDefaultStoreView('3')}}" userInput="{{multiselectProductAttribute.option3_frontend}}"/>
8686
<seeCheckboxIsChecked stepKey="seeOption3Default" selector="{{AttributePropertiesSection.dropdownNthOptionIsDefault('3')}}"/>

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
55
*/
66
use Magento\Catalog\Helper\Data;
77

88
/** @var \Magento\Backend\Block\Template $block */
99
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
10+
/** @var $escaper \Magento\Framework\Escaper */
1011
?>
1112

1213
<?php
@@ -234,7 +235,7 @@ script;
234235
elseif ($one == '_scope'):
235236
$scriptString .= 'scopeVisibility = false;';
236237
else:
237-
$scriptString .= "setRowVisibility('" . $block->escapeJs($one) . "', false);";
238+
$scriptString .= "setRowVisibility('" . $escaper->escapeJs($one) . "', false);";
238239
endif;
239240
endforeach;
240241
$scriptString .= <<<script
@@ -259,7 +260,7 @@ script;
259260
setRowVisibility('default_value_yesno', defaultValueYesnoVisibility);
260261
setRowVisibility('is_global', scopeVisibility);
261262
262-
var elems = document.getElementsByName('default[]');
263+
var elems = document.querySelectorAll('input[name^="default["]');
263264
for (var i = 0; i < elems.length; i++) {
264265
elems[i].type = optionDefaultInputType;
265266
}

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ $stores = $block->getStoresSortedBySortOrder();
7878
<input data-role="order" type="hidden" name="option[order][<%- data.id %>]" value="<%- data.sort_order %>" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()):?> disabled="disabled"<?php endif; ?>/>
7979
</td>
8080
<td class="col-default control-table-actions-cell">
81-
<input class="input-radio" type="<%- data.intype %>" name="default[]" value="<%- data.id %>" <%- data.checked %><?php if ($block->getReadOnly()):?>disabled="disabled"<?php endif;?>/>
81+
<input class="input-radio" type="<%- data.intype %>" name="default[<% if (data.intype === 'checkbox') { %><%- data.id %><% } %>]" value="<%- data.id %>" <%- data.checked %><?php if ($block->getReadOnly()):?>disabled="disabled"<?php endif;?>/>
8282
</td>
8383
<?php foreach ($stores as $_store):?>
8484
<td class="col-<%- data.id %>"><input name="option[value][<%- data.id %>][<?= (int) $_store->getId() ?>]" value="<%- data.store<?= /* @noEscape */ (int) $_store->getId() ?> %>" class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID):?> required-option required-unique<?php endif; ?>" type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()):?> disabled="disabled"<?php endif;?>/></td>

app/code/Magento/Catalog/view/adminhtml/web/js/options.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* Copyright © Magento, Inc. All rights reserved.
3-
* See COPYING.txt for license details.
2+
* Copyright 2024 Adobe
3+
* All Rights Reserved.
44
*/
55

66
/* eslint-disable no-undef */
@@ -95,7 +95,7 @@ define([
9595
}
9696
},
9797
reset: function () {
98-
jQuery('input[name="default[]"]').prop('checked', false);
98+
jQuery('input[name^="default["]').prop('checked', false);
9999
jQuery('input[name="reset_is-default_option"]').val(1);
100100
},
101101

0 commit comments

Comments
 (0)