Skip to content

Commit 2a62f1c

Browse files
authored
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop expedited
Accepted Community Pull Requests: - #23817: Resolve Incorrect base currency in order grid for historical orders issue 23805 (by @edenduong) - #23882: Fixed back redirect for view order from edit customer (by @ravi-chandra3197) - #23871: [Catalog] Fix user value verification when adding product with multiselect custom option to cart (by @Den4ik) - #23723: Resolve So many Fields in Store->Configuration->Catalog has no-validations (digit, greater than zero) (by @edenduong) - #23939: Resolve MassDelete Product will have"the counter" wrong if an EXCEPTION happens (by @edenduong) - #23868: magento/magento2#: Add description for the --type option of 'setup:db-declaration:generate-patch' command. (by @atwixfirster) - #23896: Resolve No validation "Minimum Qty" on "Minimum Qty Allowed in Shopping Cart" field (by @edenduong) - #23772: Correct Css selector paypal payment method. (by @mrkhoa99) - #23428: Fix Adapter\Pdo\Mysql::closeConnection on non-default ports (by @JacobBrownAustin) Fixed GitHub Issues: - #23805: Incorrect base currency in order grid for historical orders (reported by @dverkade) has been fixed in #23817 by @edenduong in 2.3-develop branch Related commits: 1. a52ae7e - #23863: Can't add product to cart with customizable options (type checkbox) through REST API (reported by @gekamikh) has been fixed in #23871 by @Den4ik in 2.3-develop branch Related commits: 1. 1acde36 - #23721: So many Fields in Store->Configuration->Catalog has no-validations (digit, greater than zero) (reported by @edenduong) has been fixed in #23723 by @edenduong in 2.3-develop branch Related commits: 1. 7f585fd 2. f30301d - #23895: No validation "Minimum Qty" on "Minimum Qty Allowed in Shopping Cart" field (reported by @edenduong) has been fixed in #23896 by @edenduong in 2.3-develop branch Related commits: 1. d718dc0 2. aa02d5c 3. 0c768f0
2 parents cc23756 + 24ecaed commit 2a62f1c

File tree

18 files changed

+192
-83
lines changed

18 files changed

+192
-83
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
</field>
5656
<field id="search_suggestion_count" translate="label" type="text" sortOrder="91" showInDefault="1" showInWebsite="1" showInStore="1">
5757
<label>Search Suggestions Count</label>
58+
<validate>validate-digits validate-zero-or-greater</validate>
5859
<depends>
5960
<field id="search_suggestion_enabled">1</field>
6061
</depends>

app/code/Magento/Catalog/Controller/Adminhtml/Product/MassDelete.php

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7+
declare(strict_types=1);
8+
79
namespace Magento\Catalog\Controller\Adminhtml\Product;
810

911
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
@@ -12,7 +14,14 @@
1214
use Magento\Ui\Component\MassAction\Filter;
1315
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
1416
use Magento\Catalog\Api\ProductRepositoryInterface;
17+
use Magento\Framework\Exception\CouldNotSaveException;
18+
use Magento\Framework\Exception\StateException;
19+
use Magento\Framework\Exception\LocalizedException;
20+
use Psr\Log\LoggerInterface;
1521

22+
/**
23+
* Class \Magento\Catalog\Controller\Adminhtml\Product\MassDelete
24+
*/
1625
class MassDelete extends \Magento\Catalog\Controller\Adminhtml\Product implements HttpPostActionInterface
1726
{
1827
/**
@@ -32,38 +41,55 @@ class MassDelete extends \Magento\Catalog\Controller\Adminhtml\Product implement
3241
*/
3342
private $productRepository;
3443

44+
/**
45+
* @var LoggerInterface
46+
*/
47+
private $logger;
48+
3549
/**
3650
* @param Context $context
3751
* @param Builder $productBuilder
3852
* @param Filter $filter
3953
* @param CollectionFactory $collectionFactory
4054
* @param ProductRepositoryInterface $productRepository
55+
* @param LoggerInterface $logger
4156
*/
4257
public function __construct(
4358
Context $context,
4459
Builder $productBuilder,
4560
Filter $filter,
4661
CollectionFactory $collectionFactory,
47-
ProductRepositoryInterface $productRepository = null
62+
ProductRepositoryInterface $productRepository = null,
63+
LoggerInterface $logger = null
4864
) {
4965
$this->filter = $filter;
5066
$this->collectionFactory = $collectionFactory;
51-
$this->productRepository = $productRepository
52-
?: \Magento\Framework\App\ObjectManager::getInstance()->create(ProductRepositoryInterface::class);
67+
$this->productRepository = $productRepository ?:
68+
\Magento\Framework\App\ObjectManager::getInstance()->create(ProductRepositoryInterface::class);
69+
$this->logger = $logger ?:
70+
\Magento\Framework\App\ObjectManager::getInstance()->create(LoggerInterface::class);
5371
parent::__construct($context, $productBuilder);
5472
}
5573

5674
/**
75+
* Mass Delete Action
76+
*
5777
* @return \Magento\Backend\Model\View\Result\Redirect
5878
*/
5979
public function execute()
6080
{
6181
$collection = $this->filter->getCollection($this->collectionFactory->create());
6282
$productDeleted = 0;
83+
$productDeletedError = 0;
6384
/** @var \Magento\Catalog\Model\Product $product */
6485
foreach ($collection->getItems() as $product) {
65-
$this->productRepository->delete($product);
66-
$productDeleted++;
86+
try {
87+
$this->productRepository->delete($product);
88+
$productDeleted++;
89+
} catch (LocalizedException $exception) {
90+
$this->logger->error($exception->getLogMessage());
91+
$productDeletedError++;
92+
}
6793
}
6894

6995
if ($productDeleted) {
@@ -72,6 +98,15 @@ public function execute()
7298
);
7399
}
74100

101+
if ($productDeletedError) {
102+
$this->messageManager->addErrorMessage(
103+
__(
104+
'A total of %1 record(s) haven\'t been deleted. Please see server logs for more details.',
105+
$productDeletedError
106+
)
107+
);
108+
}
109+
75110
return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)->setPath('catalog/*/index');
76111
}
77112
}

app/code/Magento/Catalog/Model/Product/Option/Type/Select.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ public function validateUserValue($values)
8484
);
8585
}
8686
if (!$this->_isSingleSelection()) {
87+
if (is_string($value)) {
88+
$value = explode(',', $value);
89+
}
8790
$valuesCollection = $option->getOptionValuesByOptionId($value, $this->getProduct()->getStoreId())->load();
8891
$valueCount = is_array($value) ? count($value) : 0;
8992
if ($valuesCollection->count() != $valueCount) {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@
4141
<label>Recently Viewed/Compared Products</label>
4242
<field id="recently_viewed_lifetime" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
4343
<label>Lifetime of products in Recently Viewed Widget</label>
44+
<validate>validate-number validate-zero-or-greater</validate>
4445
</field>
4546
<field id="recently_compared_lifetime" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
4647
<label>Lifetime of products in Recently Compared Widget</label>
48+
<validate>validate-number validate-zero-or-greater</validate>
4749
</field>
4850
<field id="synchronize_with_backend" translate="label" type="select" showInDefault="1" canRestore="1">
4951
<label>Synchronize widget products with backend storage</label>
@@ -140,6 +142,7 @@
140142
<label>Category Top Navigation</label>
141143
<field id="max_depth" translate="label" type="text" sortOrder="1" showInDefault="1" canRestore="1">
142144
<label>Maximal Depth</label>
145+
<validate>validate-digits validate-zero-or-greater</validate>
143146
</field>
144147
</group>
145148
<group id="custom_options" translate="label" type="text" sortOrder="700" showInDefault="1" showInWebsite="1" showInStore="1">
@@ -158,6 +161,7 @@
158161
</field>
159162
<field id="year_range" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1">
160163
<label>Year Range</label>
164+
<validate>validate-digits validate-zero-or-greater validate-number-range number-range-1000-9999</validate>
161165
<comment>Please use a four-digit year format.</comment>
162166
<frontend_model>Magento\Catalog\Block\Adminhtml\Form\Renderer\Config\YearRange</frontend_model>
163167
</field>

app/code/Magento/Catalog/i18n/en_US.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,4 +810,5 @@ Details,Details
810810
"Category with ID: (%1) doesn't exist", "Category with ID: (%1) doesn't exist"
811811
"You added product %1 to the <a href=""%2"">comparison list</a>.","You added product %1 to the <a href=""%2"">comparison list</a>."
812812
"Edit Product Design","Edit Product Design"
813-
"Edit Category Design","Edit Category Design"
813+
"Edit Category Design","Edit Category Design"
814+
"A total of %1 record(s) haven't been deleted. Please see server logs for more details.","A total of %1 record(s) haven't been deleted. Please see server logs for more details."

app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\CatalogInventory\Block\Adminhtml\Form\Field;
79

810
/**
@@ -51,7 +53,13 @@ protected function _prepareToRender()
5153
'customer_group_id',
5254
['label' => __('Customer Group'), 'renderer' => $this->_getGroupRenderer()]
5355
);
54-
$this->addColumn('min_sale_qty', ['label' => __('Minimum Qty')]);
56+
$this->addColumn(
57+
'min_sale_qty',
58+
[
59+
'label' => __('Minimum Qty'),
60+
'class' => 'required-entry validate-number validate-greater-than-zero'
61+
]
62+
);
5563
$this->_addAfter = false;
5664
$this->_addButtonLabel = __('Add Minimum Qty');
5765
}

app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ protected function _prepareColumns()
160160
*/
161161
public function getRowUrl($row)
162162
{
163-
return $this->getUrl('sales/order/view', ['order_id' => $row->getId()]);
163+
return $this->getUrl(
164+
'sales/order/view',
165+
['order_id' => $row->getId(), 'customer_id' => $this->getRequest()->getParam('id')]
166+
);
164167
}
165168

166169
/**

app/code/Magento/Developer/Console/Command/GeneratePatchCommand.php

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -48,41 +48,42 @@ public function __construct(ComponentRegistrar $componentRegistrar)
4848
}
4949

5050
/**
51-
* Configure command
52-
*
5351
* @inheritdoc
52+
*
5453
* @throws InvalidArgumentException
5554
*/
5655
protected function configure()
5756
{
5857
$this->setName(self::COMMAND_NAME)
5958
->setDescription('Generate patch and put it in specific folder.')
60-
->setDefinition([
61-
new InputArgument(
62-
self::MODULE_NAME,
63-
InputArgument::REQUIRED,
64-
'Module name'
65-
),
66-
new InputArgument(
67-
self::INPUT_KEY_PATCH_NAME,
68-
InputArgument::REQUIRED,
69-
'Patch name'
70-
),
71-
new InputOption(
72-
self::INPUT_KEY_IS_REVERTABLE,
73-
null,
74-
InputOption::VALUE_OPTIONAL,
75-
'Check whether patch is revertable or not.',
76-
false
77-
),
78-
new InputOption(
79-
self::INPUT_KEY_PATCH_TYPE,
80-
null,
81-
InputOption::VALUE_OPTIONAL,
82-
'Find out what type of patch should be generated.',
83-
'data'
84-
),
85-
]);
59+
->setDefinition(
60+
[
61+
new InputArgument(
62+
self::MODULE_NAME,
63+
InputArgument::REQUIRED,
64+
'Module name'
65+
),
66+
new InputArgument(
67+
self::INPUT_KEY_PATCH_NAME,
68+
InputArgument::REQUIRED,
69+
'Patch name'
70+
),
71+
new InputOption(
72+
self::INPUT_KEY_IS_REVERTABLE,
73+
null,
74+
InputOption::VALUE_OPTIONAL,
75+
'Check whether patch is revertable or not.',
76+
false
77+
),
78+
new InputOption(
79+
self::INPUT_KEY_PATCH_TYPE,
80+
null,
81+
InputOption::VALUE_OPTIONAL,
82+
'Find out what type of patch should be generated. Available values: `data`, `schema`.',
83+
'data'
84+
),
85+
]
86+
);
8687

8788
parent::configure();
8889
}
@@ -92,16 +93,17 @@ protected function configure()
9293
*
9394
* @return string
9495
*/
95-
private function getPatchTemplate() : string
96+
private function getPatchTemplate(): string
9697
{
98+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
9799
return file_get_contents(__DIR__ . '/patch_template.php.dist');
98100
}
99101

100102
/**
101103
* @inheritdoc
102104
* @throws \InvalidArgumentException
103105
*/
104-
protected function execute(InputInterface $input, OutputInterface $output) : int
106+
protected function execute(InputInterface $input, OutputInterface $output): int
105107
{
106108
$moduleName = $input->getArgument(self::MODULE_NAME);
107109
$patchName = $input->getArgument(self::INPUT_KEY_PATCH_NAME);
@@ -117,10 +119,13 @@ protected function execute(InputInterface $input, OutputInterface $output) : int
117119
$patchTemplateData = str_replace('%class%', $patchName, $patchTemplateData);
118120
$patchDir = $patchToFile = $modulePath . '/Setup/Patch/' . $preparedType;
119121

122+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
120123
if (!is_dir($patchDir)) {
124+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
121125
mkdir($patchDir, 0777, true);
122126
}
123127
$patchToFile = $patchDir . '/' . $patchName . '.php';
128+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
124129
file_put_contents($patchToFile, $patchTemplateData);
125130
return Cli::RETURN_SUCCESS;
126131
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
</field>
1717
<field id="downloads_number" translate="label" type="text" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
1818
<label>Default Maximum Number of Downloads</label>
19+
<validate>validate-digits validate-zero-or-greater</validate>
1920
</field>
2021
<field id="shareable" translate="label" type="select" sortOrder="300" showInDefault="1" showInWebsite="1" showInStore="0">
2122
<label>Shareable</label>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
</field>
1818
<field id="viewed_count" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
1919
<label>Default Recently Viewed Products Count</label>
20+
<validate>validate-digits validate-zero-or-greater</validate>
2021
</field>
2122
<field id="compared_count" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
2223
<label>Default Recently Compared Products Count</label>
24+
<validate>validate-digits validate-zero-or-greater</validate>
2325
</field>
2426
</group>
2527
</section>

0 commit comments

Comments
 (0)