Skip to content

Commit 239e4a2

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into MC-14938
# Conflicts: # app/code/Magento/Customer/Test/Mftf/ActionGroup/OpenEditCustomerFromAdminActionGroup.xml
2 parents 8e45d5f + 8f737c0 commit 239e4a2

File tree

505 files changed

+17081
-1703
lines changed

Some content is hidden

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

505 files changed

+17081
-1703
lines changed

app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ protected function saveAndReplaceAdvancedPrices()
408408
} elseif (\Magento\ImportExport\Model\Import::BEHAVIOR_APPEND == $behavior) {
409409
$this->processCountExistingPrices($tierPrices, self::TABLE_TIER_PRICE)
410410
->processCountNewPrices($tierPrices);
411+
411412
$this->saveProductPrices($tierPrices, self::TABLE_TIER_PRICE);
412413
if ($listSku) {
413414
$this->setUpdatedAt($listSku);
@@ -562,11 +563,14 @@ protected function processCountExistingPrices($prices, $table)
562563

563564
$tableName = $this->_resourceFactory->create()->getTable($table);
564565
$productEntityLinkField = $this->getProductEntityLinkField();
565-
$existingPrices = $this->_connection->fetchAssoc(
566+
$existingPrices = $this->_connection->fetchAll(
566567
$this->_connection->select()->from(
567568
$tableName,
568-
['value_id', $productEntityLinkField, 'all_groups', 'customer_group_id']
569-
)->where($productEntityLinkField . ' IN (?)', $existProductIds)
569+
[$productEntityLinkField, 'all_groups', 'customer_group_id', 'qty']
570+
)->where(
571+
$productEntityLinkField . ' IN (?)',
572+
$existProductIds
573+
)
570574
);
571575
foreach ($existingPrices as $existingPrice) {
572576
foreach ($prices as $sku => $skuPrices) {
@@ -591,8 +595,10 @@ protected function incrementCounterUpdated($prices, $existingPrice)
591595
foreach ($prices as $price) {
592596
if ($existingPrice['all_groups'] == $price['all_groups']
593597
&& $existingPrice['customer_group_id'] == $price['customer_group_id']
598+
&& (int) $existingPrice['qty'] === (int) $price['qty']
594599
) {
595600
$this->countItemsUpdated++;
601+
continue;
596602
}
597603
}
598604
}

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ public function testProcessCountExistingPrices(
921921
);
922922
$dbSelectMock = $this->createMock(\Magento\Framework\DB\Select::class);
923923
$this->connection->expects($this->once())
924-
->method('fetchAssoc')
924+
->method('fetchAll')
925925
->willReturn($existingPrices);
926926
$this->connection->expects($this->once())
927927
->method('select')
@@ -930,7 +930,7 @@ public function testProcessCountExistingPrices(
930930
->method('from')
931931
->with(
932932
self::TABLE_NAME,
933-
['value_id', self::LINK_FIELD, 'all_groups', 'customer_group_id']
933+
[self::LINK_FIELD, 'all_groups', 'customer_group_id', 'qty']
934934
)->willReturnSelf();
935935
$this->advancedPricing->expects($this->once())
936936
->method('retrieveOldSkus')

app/code/Magento/AdvancedSearch/etc/adminhtml/system.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@
4848
</depends>
4949
</field>
5050
<!--<group id="suggestions">-->
51-
<field id="search_suggestion_enabled" translate="label comment" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1">
51+
<field id="search_suggestion_enabled" translate="label comment" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1">
5252
<label>Enable Search Suggestions</label>
5353
<comment>When you enable this option your site may slow down.</comment>
5454
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
5555
</field>
56-
<field id="search_suggestion_count" translate="label" type="text" sortOrder="71" showInDefault="1" showInWebsite="1" showInStore="1">
56+
<field id="search_suggestion_count" translate="label" type="text" sortOrder="91" showInDefault="1" showInWebsite="1" showInStore="1">
5757
<label>Search Suggestions Count</label>
5858
<depends>
5959
<field id="search_suggestion_enabled">1</field>
6060
</depends>
6161
</field>
62-
<field id="search_suggestion_count_results_enabled" translate="label" type="select" sortOrder="72" showInDefault="1" showInWebsite="1" showInStore="1">
62+
<field id="search_suggestion_count_results_enabled" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="1">
6363
<label>Show Results Count for Each Suggestion</label>
6464
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
6565
<comment>When you enable this option your site may slow down.</comment>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
9+
<section name="AdminAdvancedReportingSection">
10+
<element name="goToAdvancedReporting" type="text" selector="//div[@class='dashboard-advanced-reports-actions']/a[@title='Go to Advanced Reporting']" timeout="30"/>
11+
</section>
12+
</sections>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminAdvancedReportingButtonTest">
11+
<annotations>
12+
<stories value="AdvancedReporting"/>
13+
<title value="AdvancedReportingButtonTest"/>
14+
<description value="Test log in to AdvancedReporting and tests AdvancedReportingButtonTest"/>
15+
<testCaseId value="MC-14800"/>
16+
<severity value="CRITICAL"/>
17+
<group value="analytics"/>
18+
<group value="mtf_migrated"/>
19+
</annotations>
20+
21+
<before>
22+
<actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/>
23+
</before>
24+
<after>
25+
<actionGroup ref="logout" stepKey="logout"/>
26+
</after>
27+
28+
<!--Navigate through Advanced Reporting button on dashboard to Sign Up page-->
29+
<amOnPage url="{{AdminDashboardPage.url}}" stepKey="amOnDashboardPage"/>
30+
<waitForPageLoad stepKey="waitForDashboardPageLoad"/>
31+
<click selector="{{AdminAdvancedReportingSection.goToAdvancedReporting}}" stepKey="clickGoToAdvancedReporting"/>
32+
<switchToNextTab stepKey="switchToNewTab"/>
33+
<seeInCurrentUrl url="advancedreporting.rjmetrics.com/report" stepKey="seeAssertAdvancedReportingPageUrl"/>
34+
</test>
35+
</tests>

app/code/Magento/Backend/App/Request/BackendValidator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ private function createException(
146146
$exception = new InvalidRequestException($response);
147147
} else {
148148
//For regular requests.
149+
$startPageUrl = $this->backendUrl->getStartupPageUrl();
149150
$response = $this->redirectFactory->create()
150-
->setUrl($this->backendUrl->getStartupPageUrl());
151+
->setUrl($this->backendUrl->getUrl($startPageUrl));
151152
$exception = new InvalidRequestException(
152153
$response,
153154
[

app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace Magento\Backend\Block\System\Design\Edit\Tab;
88

9+
/**
10+
* General system tab block.
11+
*/
912
class General extends \Magento\Backend\Block\Widget\Form\Generic
1013
{
1114
/**
@@ -90,7 +93,7 @@ protected function _prepareForm()
9093
]
9194
);
9295

93-
$dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
96+
$dateFormat = $this->_localeDate->getDateFormatWithLongYear();
9497
$fieldset->addField(
9598
'date_from',
9699
'date',

app/code/Magento/Backend/Model/Session/Quote.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* @method Quote setOrderId($orderId)
2525
* @method int getOrderId()
2626
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
27+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
2728
* @since 100.0.2
2829
*/
2930
class Quote extends \Magento\Framework\Session\SessionManager
@@ -149,7 +150,8 @@ public function getQuote()
149150
$this->_quote = $this->quoteFactory->create();
150151
if ($this->getStoreId()) {
151152
if (!$this->getQuoteId()) {
152-
$this->_quote->setCustomerGroupId($this->groupManagement->getDefaultGroup()->getId());
153+
$customerGroupId = $this->groupManagement->getDefaultGroup($this->getStoreId())->getId();
154+
$this->_quote->setCustomerGroupId($customerGroupId);
153155
$this->_quote->setIsActive(false);
154156
$this->_quote->setStoreId($this->getStoreId());
155157

app/code/Magento/Backend/Test/Unit/Model/Session/QuoteTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,10 @@ public function testGetQuoteWithoutQuoteId()
267267
$cartInterfaceMock->expects($this->atLeastOnce())->method('getId')->willReturn($quoteId);
268268
$defaultGroup = $this->getMockBuilder(\Magento\Customer\Api\Data\GroupInterface::class)->getMock();
269269
$defaultGroup->expects($this->any())->method('getId')->will($this->returnValue($customerGroupId));
270-
$this->groupManagementMock->expects($this->any())->method('getDefaultGroup')->willReturn($defaultGroup);
270+
$this->groupManagementMock
271+
->method('getDefaultGroup')
272+
->with($storeId)
273+
->willReturn($defaultGroup);
271274

272275
$dataCustomerMock = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)
273276
->disableOriginalConstructor()

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
<group id="debug" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
113113
<label>Debug</label>
114114
<field id="template_hints_storefront" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
115-
<label>Enabled Template Path Hints for Storefront</label>
115+
<label>Enable Template Path Hints for Storefront</label>
116116
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
117117
</field>
118118
<field id="template_hints_storefront_show_with_parameter" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
@@ -132,7 +132,7 @@
132132
<comment>Add the following parameter to the URL to show template hints ?templatehints=[parameter_value]</comment>
133133
</field>
134134
<field id="template_hints_admin" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
135-
<label>Enabled Template Path Hints for Admin</label>
135+
<label>Enable Template Path Hints for Admin</label>
136136
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
137137
</field>
138138
<field id="template_hints_blocks" translate="label" type="select" sortOrder="21" showInDefault="1" showInWebsite="1" showInStore="1">

app/code/Magento/Backup/Model/Db.php

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\Backup\Model;
77

88
use Magento\Backup\Helper\Data as Helper;
9+
use Magento\Backup\Model\ResourceModel\Table\GetListTables;
10+
use Magento\Backup\Model\ResourceModel\View\CreateViewsBackup;
911
use Magento\Framework\App\ObjectManager;
1012
use Magento\Framework\Exception\RuntimeException;
1113

@@ -44,18 +46,35 @@ class Db implements \Magento\Framework\Backup\Db\BackupDbInterface
4446
private $helper;
4547

4648
/**
47-
* @param \Magento\Backup\Model\ResourceModel\Db $resourceDb
49+
* @var GetListTables
50+
*/
51+
private $getListTables;
52+
53+
/**
54+
* @var CreateViewsBackup
55+
*/
56+
private $getViewsBackup;
57+
58+
/**
59+
* Db constructor.
60+
* @param ResourceModel\Db $resourceDb
4861
* @param \Magento\Framework\App\ResourceConnection $resource
4962
* @param Helper|null $helper
63+
* @param GetListTables|null $getListTables
64+
* @param CreateViewsBackup|null $getViewsBackup
5065
*/
5166
public function __construct(
52-
\Magento\Backup\Model\ResourceModel\Db $resourceDb,
67+
ResourceModel\Db $resourceDb,
5368
\Magento\Framework\App\ResourceConnection $resource,
54-
?Helper $helper = null
69+
?Helper $helper = null,
70+
?GetListTables $getListTables = null,
71+
?CreateViewsBackup $getViewsBackup = null
5572
) {
5673
$this->_resourceDb = $resourceDb;
5774
$this->_resource = $resource;
5875
$this->helper = $helper ?? ObjectManager::getInstance()->get(Helper::class);
76+
$this->getListTables = $getListTables ?? ObjectManager::getInstance()->get(GetListTables::class);
77+
$this->getViewsBackup = $getViewsBackup ?? ObjectManager::getInstance()->get(CreateViewsBackup::class);
5978
}
6079

6180
/**
@@ -161,7 +180,7 @@ public function createBackup(\Magento\Framework\Backup\Db\BackupInterface $backu
161180

162181
$this->getResource()->beginTransaction();
163182

164-
$tables = $this->getResource()->getTables();
183+
$tables = $this->getListTables->execute();
165184

166185
$backup->write($this->getResource()->getHeader());
167186

@@ -198,6 +217,8 @@ public function createBackup(\Magento\Framework\Backup\Db\BackupInterface $backu
198217
$backup->write($this->getResource()->getTableDataAfterSql($table));
199218
}
200219
}
220+
$this->getViewsBackup->execute($backup);
221+
201222
$backup->write($this->getResource()->getTableForeignKeysSql());
202223
$backup->write($this->getResource()->getTableTriggersSql());
203224
$backup->write($this->getResource()->getFooter());
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Backup\Model\ResourceModel\Table;
9+
10+
use Magento\Framework\App\ResourceConnection;
11+
12+
/**
13+
* Provides full list of tables in the database. This list excludes views, to allow different backup process.
14+
*/
15+
class GetListTables
16+
{
17+
private const TABLE_TYPE = 'BASE TABLE';
18+
19+
/**
20+
* @var ResourceConnection
21+
*/
22+
private $resource;
23+
24+
/**
25+
* @param ResourceConnection $resource
26+
*/
27+
public function __construct(ResourceConnection $resource)
28+
{
29+
$this->resource = $resource;
30+
}
31+
32+
/**
33+
* Get list of database tables excluding views.
34+
*
35+
* @return array
36+
*/
37+
public function execute(): array
38+
{
39+
return $this->resource->getConnection('backup')->fetchCol(
40+
"SHOW FULL TABLES WHERE `Table_type` = ?",
41+
self::TABLE_TYPE
42+
);
43+
}
44+
}

0 commit comments

Comments
 (0)