Skip to content

Commit 4a20d6e

Browse files
committed
Merge remote-tracking branch 'engcom-Hotel/grid_search_selectall_issue' into grid_search_selectall_issue
2 parents f019712 + 8a9546f commit 4a20d6e

File tree

61 files changed

+1115
-113
lines changed

Some content is hidden

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

61 files changed

+1115
-113
lines changed

app/code/Magento/Bundle/Model/Product/LinksList.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public function __construct(
3939
}
4040

4141
/**
42+
* Bundle Product Items Data
43+
*
4244
* @param \Magento\Catalog\Api\Data\ProductInterface $product
4345
* @param int $optionId
4446
* @return \Magento\Bundle\Api\Data\LinkInterface[]
@@ -50,8 +52,12 @@ public function getItems(\Magento\Catalog\Api\Data\ProductInterface $product, $o
5052
$productLinks = [];
5153
/** @var \Magento\Catalog\Model\Product $selection */
5254
foreach ($selectionCollection as $selection) {
55+
$bundledProductPrice = $selection->getSelectionPriceValue();
56+
if ($bundledProductPrice <= 0) {
57+
$bundledProductPrice = $selection->getPrice();
58+
}
5359
$selectionPriceType = $product->getPriceType() ? $selection->getSelectionPriceType() : null;
54-
$selectionPrice = $product->getPriceType() ? $selection->getSelectionPriceValue() : null;
60+
$selectionPrice = $bundledProductPrice ? $bundledProductPrice : null;
5561

5662
/** @var \Magento\Bundle\Api\Data\LinkInterface $productLink */
5763
$productLink = $this->linkFactory->create();

app/code/Magento/Bundle/Test/Unit/Model/Product/LinksListTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function testLinksList()
9191
->method('getSelectionsCollection')
9292
->with([$optionId], $this->productMock)
9393
->willReturn([$this->selectionMock]);
94-
$this->productMock->expects($this->exactly(2))->method('getPriceType')->willReturn('price_type');
94+
$this->productMock->expects($this->once())->method('getPriceType')->willReturn('price_type');
9595
$this->selectionMock->expects($this->once())
9696
->method('getSelectionPriceType')
9797
->willReturn('selection_price_type');

app/code/Magento/Catalog/view/frontend/templates/product/list.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ $_helper = $block->getData('outputHelper');
9898
<?= $block->getBlockHtml('formkey') ?>
9999
<button type="submit"
100100
title="<?= $escaper->escapeHtmlAttr(__('Add to Cart')) ?>"
101-
class="action tocart primary">
101+
class="action tocart primary"
102+
disabled>
102103
<span><?= $escaper->escapeHtml(__('Add to Cart')) ?></span>
103104
</button>
104105
</form>

app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ define([
3434
if (this.options.bindSubmit) {
3535
this._bindSubmit();
3636
}
37+
$(this.options.addToCartButtonSelector).attr('disabled', false);
3738
},
3839

3940
/**

app/code/Magento/Contact/view/frontend/templates/form.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ $viewModel = $block->getViewModel();
6969
class="input-text"
7070
cols="5"
7171
rows="3"
72-
data-validate="{required:true}"><?= $block->escapeHtml($viewModel->getUserComment()) ?>
73-
</textarea>
72+
data-validate="{required:true}"
73+
><?= $block->escapeHtml($viewModel->getUserComment()) ?></textarea>
7474
</div>
7575
</div>
7676
<?= $block->getChildHtml('form.additional.info') ?>

app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ protected function _prepareLayout()
4141
]
4242
);
4343

44-
$onClick = "setLocation('" . $this->getUrl('adminhtml/system_config/edit/section/currency') . "')";
44+
$currencyOptionPath = $this->getUrl(
45+
'adminhtml/system_config/edit',
46+
[
47+
'section' => 'currency',
48+
'_fragment' => 'currency_options-link'
49+
]
50+
);
51+
$onClick = "setLocation('$currencyOptionPath')";
4552

4653
$this->getToolbar()->addChild(
4754
'options_button',
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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="AdminNavigateToCurrencyRatesOptionActionGroup">
12+
<click selector="{{AdminCurrencyRatesSection.options}}" stepKey="clickOptionsButton"/>
13+
<waitForPageLoad stepKey="waitForPageLoad"/>
14+
</actionGroup>
15+
</actionGroups>

app/code/Magento/CurrencySymbol/Test/Mftf/Section/AdminCurrencyRatesSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<section name="AdminCurrencyRatesSection">
1212
<element name="import" type="button" selector="//button[@title='Import']"/>
1313
<element name="saveCurrencyRates" type="button" selector="//button[@title='Save Currency Rates']"/>
14+
<element name="options" type="button" selector="//button[@title='Options']"/>
1415
<element name="oldRate" type="text" selector="//div[contains(@class, 'admin__field-note') and contains(text(), 'Old rate:')]/strong"/>
1516
<element name="rateService" type="select" selector="#rate_services"/>
1617
<element name="currencyRate" type="input" selector="input[name='rate[{{fistCurrency}}][{{secondCurrency}}]']" parameterized="true"/>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminCurrencyOptionsSystemConfigExpandedTabTest">
12+
<annotations>
13+
<features value="Expanded tab on Currency Option page"/>
14+
<stories value="Expanded tab"/>
15+
<title value=" Verify the Currency Option tab expands automatically."/>
16+
<description value="Check auto open the collapse on Currency Option page."/>
17+
<severity value="MINOR"/>
18+
<testCaseId value="MC-37425"/>
19+
</annotations>
20+
<before>
21+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
22+
</before>
23+
<after>
24+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
25+
</after>
26+
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToStoresCurrencyRatesPage">
27+
<argument name="menuUiId" value="{{AdminMenuStores.dataUiId}}"/>
28+
<argument name="submenuUiId" value="{{AdminMenuStoresCurrencyCurrencyRates.dataUiId}}"/>
29+
</actionGroup>
30+
<actionGroup ref="AdminNavigateToCurrencyRatesOptionActionGroup" stepKey="navigateToOptions" />
31+
<grabAttributeFrom selector="{{CurrencySetupSection.currencyOptions}}" userInput="class" stepKey="grabClass"/>
32+
<assertStringContainsString stepKey="assertClass">
33+
<actualResult type="string">{$grabClass}</actualResult>
34+
<expectedResult type="string">open</expectedResult>
35+
</assertStringContainsString>
36+
</test>
37+
</tests>

app/code/Magento/CurrencySymbol/Test/Unit/Block/Adminhtml/System/CurrencyTest.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,22 @@
77

88
namespace Magento\CurrencySymbol\Test\Unit\Block\Adminhtml\System;
99

10+
use Magento\Backend\Block\Template\Context;
1011
use Magento\Backend\Block\Widget\Button;
1112
use Magento\CurrencySymbol\Block\Adminhtml\System\Currency;
1213
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1314
use Magento\Framework\View\Element\BlockInterface;
1415
use Magento\Framework\View\LayoutInterface;
1516
use PHPUnit\Framework\TestCase;
17+
use Magento\Framework\UrlInterface;
1618

1719
class CurrencyTest extends TestCase
1820
{
21+
/**
22+
* Stub currency option link url
23+
*/
24+
const STUB_OPTION_LINK_URL = 'https://localhost/admin/system_config/edit/section/currency#currency_options-link';
25+
1926
/**
2027
* Object manager helper
2128
*
@@ -70,12 +77,25 @@ public function testPrepareLayout()
7077
]
7178
);
7279

80+
$contextMock = $this->createMock(Context::class);
81+
$urlBuilderMock = $this->createMock(UrlInterface::class);
82+
83+
$contextMock->expects($this->once())->method('getUrlBuilder')->willReturn($urlBuilderMock);
84+
85+
$urlBuilderMock->expects($this->once())->method('getUrl')->with(
86+
'adminhtml/system_config/edit',
87+
[
88+
'section' => 'currency',
89+
'_fragment' => 'currency_options-link'
90+
]
91+
)->willReturn(self::STUB_OPTION_LINK_URL);
92+
7393
$childBlockMock->expects($this->at(1))
7494
->method('addChild')
7595
->with(
7696
'options_button',
7797
Button::class,
78-
['label' => __('Options'), 'onclick' => 'setLocation(\'\')']
98+
['label' => __('Options'), 'onclick' => 'setLocation(\''.self::STUB_OPTION_LINK_URL.'\')']
7999
);
80100

81101
$childBlockMock->expects($this->at(2))
@@ -90,7 +110,8 @@ public function testPrepareLayout()
90110
$block = $this->objectManagerHelper->getObject(
91111
Currency::class,
92112
[
93-
'layout' => $layoutMock
113+
'layout' => $layoutMock,
114+
'context' => $contextMock
94115
]
95116
);
96117
$block->setLayout($layoutMock);

app/code/Magento/Eav/Model/Entity/AbstractEntity.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,8 @@ protected function _isApplicableAttribute($object, $attribute)
626626
public function walkAttributes($partMethod, array $args = [], $collectExceptionMessages = null)
627627
{
628628
$methodArr = explode('/', $partMethod);
629+
$part = '';
630+
$method = '';
629631
switch (count($methodArr)) {
630632
case 1:
631633
$part = 'attribute';
@@ -642,6 +644,7 @@ public function walkAttributes($partMethod, array $args = [], $collectExceptionM
642644
}
643645
$results = [];
644646
$suffix = $this->getAttributesCacheSuffix($args[0]);
647+
$instance = null;
645648
foreach ($this->getAttributesByScope($suffix) as $attrCode => $attribute) {
646649
if (isset($args[0]) && is_object($args[0]) && !$this->_isApplicableAttribute($args[0], $attribute)) {
647650
continue;
@@ -1337,7 +1340,9 @@ protected function _collectSaveData($newObject)
13371340
if ($this->_canUpdateAttribute($attribute, $v, $origData)) {
13381341
if ($this->_isAttributeValueEmpty($attribute, $v)) {
13391342
$this->_aggregateDeleteData($delete, $attribute, $newObject);
1340-
} elseif (!is_numeric($v) && $v !== $origData[$k] || is_numeric($v) && $v != $origData[$k]) {
1343+
} elseif (!is_numeric($v) && $v !== $origData[$k]
1344+
|| is_numeric($v) && ($v != $origData[$k] || strlen($v) !== strlen($origData[$k]))
1345+
) {
13411346
$update[$attrId] = [
13421347
'value_id' => $attribute->getBackend()->getEntityValueId($newObject),
13431348
'value' => is_array($v) ? array_shift($v) : $v,//@TODO: MAGETWO-44182,
@@ -1739,6 +1744,7 @@ public function delete($object)
17391744
{
17401745
try {
17411746
$connection = $this->transactionManager->start($this->getConnection());
1747+
$id = 0;
17421748
if (is_numeric($object)) {
17431749
$id = (int) $object;
17441750
} elseif ($object instanceof \Magento\Framework\Model\AbstractModel) {

app/code/Magento/Elasticsearch/Model/Adapter/Elasticsearch.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,12 @@ protected function prepareIndex($storeId, $indexName, $mappedIndexerId)
497497
*/
498498
private function getMappingTotalFieldsLimit(array $allAttributeTypes): int
499499
{
500-
return count($allAttributeTypes) + self::MAPPING_TOTAL_FIELDS_BUFFER_LIMIT;
500+
$count = count($allAttributeTypes);
501+
foreach ($allAttributeTypes as $attributeType) {
502+
if (isset($attributeType['fields'])) {
503+
$count += count($attributeType['fields']);
504+
}
505+
}
506+
return $count + self::MAPPING_TOTAL_FIELDS_BUFFER_LIMIT;
501507
}
502508
}

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/ElasticsearchTest.php

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,14 @@ protected function setUp(): void
174174
->method('getAllAttributesTypes')
175175
->willReturn(
176176
[
177-
'name' => 'string',
177+
'name' => [
178+
'type' => 'string',
179+
'fields' => [
180+
'keyword' => [
181+
'type' => "keyword",
182+
],
183+
],
184+
],
178185
]
179186
);
180187
$this->clientConfig->expects($this->any())
@@ -564,6 +571,28 @@ public function testUpdateIndexMappingWithAliasDefinition(): void
564571
$this->model->updateIndexMapping($storeId, $mappedIndexerId, $attributeCode);
565572
}
566573

574+
/**
575+
* Test for get mapping total fields limit
576+
*
577+
* @return void
578+
*/
579+
public function testGetMappingTotalFieldsLimit(): void
580+
{
581+
$settings = [
582+
'index' => [
583+
'mapping' => [
584+
'total_fields' => [
585+
'limit' => 1002
586+
]
587+
]
588+
]
589+
];
590+
$this->client->expects($this->at(1))
591+
->method('createIndex')
592+
->with(null, ['settings' => $settings]);
593+
$this->model->cleanIndex(1, 'product');
594+
}
595+
567596
/**
568597
* Get elasticsearch client options
569598
*

app/code/Magento/Sales/Model/ResourceModel/Order.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ protected function _construct()
5353

5454
/**
5555
* @param \Magento\Framework\Model\ResourceModel\Db\Context $context
56-
* @param Attribute $attribute
57-
* @param Manager $sequenceManager
5856
* @param Snapshot $entitySnapshot
5957
* @param RelationComposite $entityRelationComposite
58+
* @param Attribute $attribute
59+
* @param Manager $sequenceManager
6060
* @param StateHandler $stateHandler
61-
* @param string $connectionName
61+
* @param string|null $connectionName
6262
*/
6363
public function __construct(
6464
\Magento\Framework\Model\ResourceModel\Db\Context $context,
@@ -137,6 +137,8 @@ protected function calculateItems(\Magento\Sales\Model\Order $object)
137137
}
138138

139139
/**
140+
* Before save
141+
*
140142
* @param \Magento\Framework\Model\AbstractModel $object
141143
* @return $this
142144
*/
@@ -152,15 +154,15 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
152154
];
153155
$object->setStoreName(implode(PHP_EOL, $name));
154156
$object->setTotalItemCount($this->calculateItems($object));
157+
$object->setData(
158+
'protect_code',
159+
substr(
160+
hash('sha256', uniqid(Random::getRandomNumber(), true) . ':' . microtime(true)),
161+
5,
162+
32
163+
)
164+
);
155165
}
156-
$object->setData(
157-
'protect_code',
158-
substr(
159-
hash('sha256', uniqid(Random::getRandomNumber(), true) . ':' . microtime(true)),
160-
5,
161-
32
162-
)
163-
);
164166
$isNewCustomer = !$object->getCustomerId() || $object->getCustomerId() === true;
165167
if ($isNewCustomer && $object->getCustomer()) {
166168
$object->setCustomerId($object->getCustomer()->getId());
@@ -169,7 +171,7 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
169171
}
170172

171173
/**
172-
* {@inheritdoc}
174+
* @inheritdoc
173175
*/
174176
public function save(\Magento\Framework\Model\AbstractModel $object)
175177
{

app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsCsv.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
use Magento\Framework\View\Result\Layout;
1616
use Magento\Framework\App\ResponseInterface;
1717
use Magento\Framework\App\Action\HttpGetActionInterface;
18+
use Magento\Framework\App\Action\HttpPostActionInterface;
1819

1920
/**
2021
* Export Coupons to csv file
2122
*
2223
* Class \Magento\SalesRule\Controller\Adminhtml\Promo\Quote\ExportCouponsCsv
2324
*/
24-
class ExportCouponsCsv extends Quote implements HttpGetActionInterface
25+
class ExportCouponsCsv extends Quote implements HttpGetActionInterface, HttpPostActionInterface
2526
{
2627
/**
2728
* Export coupon codes as CSV file

app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/ExportCouponsXml.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
use Magento\Framework\View\Result\Layout;
1616
use Magento\Framework\App\ResponseInterface;
1717
use Magento\Framework\App\Action\HttpGetActionInterface;
18+
use Magento\Framework\App\Action\HttpPostActionInterface;
1819

1920
/**
2021
* Export coupons to xml file
2122
*
2223
* Class \Magento\SalesRule\Controller\Adminhtml\Promo\Quote\ExportCouponsXml
2324
*/
24-
class ExportCouponsXml extends Quote implements HttpGetActionInterface
25+
class ExportCouponsXml extends Quote implements HttpGetActionInterface, HttpPostActionInterface
2526
{
2627
/**
2728
* Export coupon codes as excel xml file

app/code/Magento/Ui/view/base/web/js/form/element/ui-select.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ define([
668668
* @returns {Object} Chainable
669669
*/
670670
toggleListVisible: function () {
671-
this.listVisible(!this.listVisible());
671+
this.listVisible(!this.disabled() && !this.listVisible());
672672

673673
return this;
674674
},

0 commit comments

Comments
 (0)