Skip to content

Commit 3008324

Browse files
authored
Merge pull request magento#5925 from magento-tsg/2.4-develop-pr66
[TSG] Fixes for 2.4 (pr66) (2.4-develop)
2 parents 8f42112 + 6d92055 commit 3008324

File tree

5 files changed

+81
-5
lines changed

5 files changed

+81
-5
lines changed

app/code/Magento/SalesSequence/Model/Sequence/DeleteByStore.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function execute($storeId): void
5858
$metadataIds = $this->getMetadataIdsByStoreId($storeId);
5959
$profileIds = $this->getProfileIdsByMetadataIds($metadataIds);
6060

61-
$this->appResource->getConnection()->delete(
61+
$this->appResource->getConnection('sales')->delete(
6262
$this->appResource->getTableName('sales_sequence_profile'),
6363
['profile_id IN (?)' => $profileIds]
6464
);
@@ -70,7 +70,7 @@ public function execute($storeId): void
7070
continue;
7171
}
7272

73-
$this->appResource->getConnection()->dropTable(
73+
$this->appResource->getConnection('sales')->dropTable(
7474
$metadata->getSequenceTable()
7575
);
7676
$this->resourceMetadata->delete($metadata);
@@ -85,7 +85,7 @@ public function execute($storeId): void
8585
*/
8686
private function getMetadataIdsByStoreId($storeId)
8787
{
88-
$connection = $this->appResource->getConnection();
88+
$connection = $this->appResource->getConnection('sales');
8989
$bind = ['store_id' => $storeId];
9090
$select = $connection->select()->from(
9191
$this->appResource->getTableName('sales_sequence_meta'),
@@ -105,7 +105,7 @@ private function getMetadataIdsByStoreId($storeId)
105105
*/
106106
private function getProfileIdsByMetadataIds(array $metadataIds)
107107
{
108-
$connection = $this->appResource->getConnection();
108+
$connection = $this->appResource->getConnection('sales');
109109
$select = $connection->select()
110110
->from(
111111
$this->appResource->getTableName('sales_sequence_profile'),

app/code/Magento/SalesSequence/Test/Unit/Model/Sequence/DeleteByStoreTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ static function ($tableName) {
110110
}
111111
);
112112
$this->resourceMock->method('getConnection')
113+
->with('sales')
113114
->willReturn($this->connectionMock);
114115
$this->connectionMock
115116
->method('select')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
use Magento\Catalog\Api\Data\ProductInterfaceFactory;
9+
use Magento\Catalog\Model\Product\Attribute\Source\Status;
10+
use Magento\Catalog\Model\Product\Type;
11+
use Magento\Catalog\Model\Product\Visibility;
12+
use Magento\Framework\ObjectManagerInterface;
13+
use Magento\Store\Api\WebsiteRepositoryInterface;
14+
use Magento\TestFramework\Helper\Bootstrap;
15+
use Magento\Catalog\Api\ProductRepositoryInterface;
16+
17+
/** @var ObjectManagerInterface $objectManager */
18+
$objectManager = Bootstrap::getObjectManager();
19+
/** @var WebsiteRepositoryInterface $websiteRepository */
20+
$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class);
21+
$baseWebsiteId = $websiteRepository->get('base')->getId();
22+
23+
$productFactory = $objectManager->get(ProductInterfaceFactory::class);
24+
$product = $productFactory->create();
25+
$product->setTypeId(Type::TYPE_SIMPLE)
26+
->setAttributeSetId($product->getDefaultAttributeSetId())
27+
->setWebsiteIds([$baseWebsiteId])
28+
->setName('Простий продукт')
29+
->setSku('Продукт')
30+
->setDescription('Повний опис продукту')
31+
->setShortDescription('Короткий опис')
32+
->setPrice(10)
33+
->setTaxClassId(0)
34+
->setVisibility(Visibility::VISIBILITY_BOTH)
35+
->setStatus(Status::STATUS_ENABLED)
36+
->setStockData(
37+
[
38+
'qty' => 100,
39+
'is_in_stock' => 1,
40+
'manage_stock' => 1,
41+
]
42+
);
43+
/** @var ProductRepositoryInterface $productRepository */
44+
$productRepository = $objectManager->get(ProductRepositoryInterface::class);
45+
$productRepository->save($product);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
use Magento\Catalog\Api\ProductRepositoryInterface;
9+
use Magento\Framework\Exception\NoSuchEntityException;
10+
use Magento\Framework\Registry;
11+
use Magento\TestFramework\Helper\Bootstrap;
12+
13+
/** @var Registry $registry */
14+
$registry = Bootstrap::getObjectManager()->get(Registry::class);
15+
16+
$registry->unregister('isSecureArea');
17+
$registry->register('isSecureArea', true);
18+
19+
/** @var ProductRepositoryInterface $productRepository */
20+
$productRepository = Bootstrap::getObjectManager()->get(ProductRepositoryInterface::class);
21+
22+
try {
23+
$product = $productRepository->get('Продукт', false, null, true);
24+
$productRepository->delete($product);
25+
} catch (NoSuchEntityException $exception) {
26+
//Product already removed
27+
}
28+
29+
$registry->unregister('isSecureArea');
30+
$registry->register('isSecureArea', false);

lib/web/mage/validation.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@ define([
19721972

19731973
if (firstActive.length) {
19741974
$('html, body').stop().animate({
1975-
scrollTop: firstActive.offset().top - windowHeight / 2
1975+
scrollTop: firstActive.parent().offset().top - windowHeight / 2
19761976
});
19771977
firstActive.focus();
19781978
}

0 commit comments

Comments
 (0)