Skip to content

Commit 9ae5ba2

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop
Accepted Community Pull Requests: - #24369: Correct spelling (by @ravi-chandra3197) - #24331: magento/magento2#: �Bad request� is never shown (by @atwixfirster) - #24285: magento/magento2#: Replace deprecated methods in back-end controllers of Magento/Customer (by @atwixfirster) - #24313: Resolve "Send Payment Failed Email Copy To" field has no validate email issue24312 (by @edenduong) - #24283: Resolve undefined variable in cleanFileExtensions() function (by @edenduong) - #23764: group_id overridden if set (by @kickDominic) Fixed GitHub Issues: - #24330: �Bad request� error message is never shown (reported by @atwixfirster) has been fixed in #24331 by @atwixfirster in 2.3-develop branch Related commits: 1. 40c0e28 2. e586901 - #24302: No validate "Day" in PayPal Express Checkout Settings (reported by @edenduong) has been fixed in #24313 by @edenduong in 2.3-develop branch Related commits: 1. afc57f9 2. 35befe1 3. 57db0ea 4. 66f8376 5. 8cc0b25 6. c68b200 7. aca055b 8. f48c62b 9. 21b91d9 - #24304: No validate "Proxy Port" in Paypal Module (Paypal Express, Paypal Payflow -Link, Pro, Advanced) (reported by @edenduong) has been fixed in #24313 by @edenduong in 2.3-develop branch Related commits: 1. afc57f9 2. 35befe1 3. 57db0ea 4. 66f8376 5. 8cc0b25 6. c68b200 7. aca055b 8. f48c62b 9. 21b91d9 - #24307: Many field has no validate number in Checkout settings (reported by @edenduong) has been fixed in #24313 by @edenduong in 2.3-develop branch Related commits: 1. afc57f9 2. 35befe1 3. 57db0ea 4. 66f8376 5. 8cc0b25 6. c68b200 7. aca055b 8. f48c62b 9. 21b91d9 - #24312: "Send Payment Failed Email Copy To" field has no validate email (reported by @edenduong) has been fixed in #24313 by @edenduong in 2.3-develop branch Related commits: 1. afc57f9 2. 35befe1 3. 57db0ea 4. 66f8376 5. 8cc0b25 6. c68b200 7. aca055b 8. f48c62b 9. 21b91d9
2 parents ebee07a + 30b1cc5 commit 9ae5ba2

File tree

28 files changed

+203
-115
lines changed

28 files changed

+203
-115
lines changed

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

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ protected function _getResource()
167167
}
168168

169169
/**
170+
* Construct function
171+
*
170172
* @return void
171173
*/
172174
protected function _construct()
@@ -215,6 +217,8 @@ public function hasValues($type = null)
215217
}
216218

217219
/**
220+
* Get values
221+
*
218222
* @return ProductCustomOptionValuesInterface[]|null
219223
*/
220224
public function getValues()
@@ -345,7 +349,8 @@ public function groupFactory($type)
345349
}
346350

347351
/**
348-
* {@inheritdoc}
352+
* @inheritdoc
353+
*
349354
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
350355
* @since 101.0.0
351356
*/
@@ -396,6 +401,8 @@ public function beforeSave()
396401
}
397402

398403
/**
404+
* After save
405+
*
399406
* @return \Magento\Framework\Model\AbstractModel
400407
* @throws \Magento\Framework\Exception\LocalizedException
401408
*/
@@ -424,7 +431,8 @@ public function afterSave()
424431

425432
/**
426433
* Return price. If $flag is true and price is percent
427-
* return converted percent to price
434+
*
435+
* Return converted percent to price
428436
*
429437
* @param bool $flag
430438
* @return float
@@ -555,7 +563,7 @@ protected function _clearReferences()
555563
}
556564

557565
/**
558-
* {@inheritdoc}
566+
* @inheritdoc
559567
*/
560568
protected function _getValidationRulesBeforeSave()
561569
{
@@ -649,6 +657,8 @@ public function getSku()
649657
}
650658

651659
/**
660+
* Get file extension
661+
*
652662
* @return string|null
653663
*/
654664
public function getFileExtension()
@@ -657,6 +667,8 @@ public function getFileExtension()
657667
}
658668

659669
/**
670+
* Get Max Characters
671+
*
660672
* @return int|null
661673
*/
662674
public function getMaxCharacters()
@@ -665,6 +677,8 @@ public function getMaxCharacters()
665677
}
666678

667679
/**
680+
* Get image size X
681+
*
668682
* @return int|null
669683
*/
670684
public function getImageSizeX()
@@ -673,6 +687,8 @@ public function getImageSizeX()
673687
}
674688

675689
/**
690+
* Get image size Y
691+
*
676692
* @return int|null
677693
*/
678694
public function getImageSizeY()
@@ -780,6 +796,8 @@ public function setSku($sku)
780796
}
781797

782798
/**
799+
* Set File Extension
800+
*
783801
* @param string $fileExtension
784802
* @return $this
785803
*/
@@ -789,6 +807,8 @@ public function setFileExtension($fileExtension)
789807
}
790808

791809
/**
810+
* Set Max Characters
811+
*
792812
* @param int $maxCharacters
793813
* @return $this
794814
*/
@@ -798,6 +818,8 @@ public function setMaxCharacters($maxCharacters)
798818
}
799819

800820
/**
821+
* Set Image Size X
822+
*
801823
* @param int $imageSizeX
802824
* @return $this
803825
*/
@@ -807,6 +829,8 @@ public function setImageSizeX($imageSizeX)
807829
}
808830

809831
/**
832+
* Set Image Size Y
833+
*
810834
* @param int $imageSizeY
811835
* @return $this
812836
*/
@@ -816,6 +840,8 @@ public function setImageSizeY($imageSizeY)
816840
}
817841

818842
/**
843+
* Set value
844+
*
819845
* @param ProductCustomOptionValuesInterface[] $values
820846
* @return $this
821847
*/
@@ -826,7 +852,7 @@ public function setValues(array $values = null)
826852
}
827853

828854
/**
829-
* {@inheritdoc}
855+
* @inheritdoc
830856
*
831857
* @return \Magento\Catalog\Api\Data\ProductCustomOptionExtensionInterface|null
832858
*/
@@ -852,6 +878,8 @@ public function getRegularPrice()
852878
}
853879

854880
/**
881+
* Get Product Option Collection
882+
*
855883
* @param Product $product
856884
* @return \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
857885
*/
@@ -882,7 +910,7 @@ public function getProductOptionCollection(Product $product)
882910
}
883911

884912
/**
885-
* {@inheritdoc}
913+
* @inheritdoc
886914
*
887915
* @param \Magento\Catalog\Api\Data\ProductCustomOptionExtensionInterface $extensionAttributes
888916
* @return $this
@@ -894,6 +922,8 @@ public function setExtensionAttributes(
894922
}
895923

896924
/**
925+
* Get option repository
926+
*
897927
* @return Option\Repository
898928
*/
899929
private function getOptionRepository()
@@ -906,6 +936,8 @@ private function getOptionRepository()
906936
}
907937

908938
/**
939+
* Get metadata pool
940+
*
909941
* @return \Magento\Framework\EntityManager\MetadataPool
910942
*/
911943
private function getMetadataPool()
@@ -931,7 +963,7 @@ private function cleanFileExtensions()
931963
preg_match_all('/(?<extensions>[a-z0-9]+)/i', strtolower($rawExtensions), $matches);
932964
if (!empty($matches)) {
933965
$extensions = implode(', ', array_unique($matches['extensions']));
966+
$this->setFileExtension($extensions);
934967
}
935-
$this->setFileExtension($extensions);
936968
}
937969
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,22 @@
2727
</field>
2828
<field id="max_items_display_count" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
2929
<label>Maximum Number of Items to Display in Order Summary</label>
30+
<validate>validate-zero-or-greater validate-digits</validate>
3031
</field>
3132
</group>
3233
<group id="cart" translate="label" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
3334
<label>Shopping Cart</label>
3435
<field id="delete_quote_after" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
3536
<label>Quote Lifetime (days)</label>
37+
<validate>validate-zero-or-greater validate-digits</validate>
3638
</field>
3739
<field id="redirect_to_cart" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
3840
<label>After Adding a Product Redirect to Shopping Cart</label>
3941
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
4042
</field>
4143
<field id="number_items_to_display_pager" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
4244
<label>Number of Items to Display Pager</label>
45+
<validate>validate-zero-or-greater validate-digits</validate>
4346
</field>
4447
<field id="crosssell_enabled" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
4548
<label>Show Cross-sell Items in the Shopping Cart</label>
@@ -61,9 +64,11 @@
6164
</field>
6265
<field id="count" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
6366
<label>Number of Items to Display Scrollbar</label>
67+
<validate>validate-zero-or-greater validate-digits</validate>
6468
</field>
6569
<field id="max_items_display_count" translate="label" type="text" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
6670
<label>Maximum Number of Items to Display</label>
71+
<validate>validate-zero-or-greater validate-digits</validate>
6772
</field>
6873
</group>
6974
<group id="payment_failed" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
@@ -83,6 +88,7 @@
8388
</field>
8489
<field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1">
8590
<label>Send Payment Failed Email Copy To</label>
91+
<validate>validate-emails</validate>
8692
<comment>Separate by ",".</comment>
8793
</field>
8894
<field id="copy_method" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">

app/code/Magento/Customer/Controller/Account/Confirm.php

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,27 @@
66
*/
77
namespace Magento\Customer\Controller\Account;
88

9-
use Magento\Customer\Model\Url;
10-
use Magento\Framework\App\Action\Context;
11-
use Magento\Customer\Model\Session;
12-
use Magento\Framework\App\Config\ScopeConfigInterface;
13-
use Magento\Store\Model\StoreManagerInterface;
149
use Magento\Customer\Api\AccountManagementInterface;
1510
use Magento\Customer\Api\CustomerRepositoryInterface;
11+
use Magento\Customer\Controller\AbstractAccount;
1612
use Magento\Customer\Helper\Address;
13+
use Magento\Customer\Model\Session;
14+
use Magento\Customer\Model\Url;
15+
use Magento\Framework\App\Action\Context;
16+
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
17+
use Magento\Framework\App\Config\ScopeConfigInterface;
18+
use Magento\Framework\Controller\ResultFactory;
1719
use Magento\Framework\UrlFactory;
1820
use Magento\Framework\Exception\StateException;
1921
use Magento\Store\Model\ScopeInterface;
20-
use Magento\Framework\Controller\ResultFactory;
22+
use Magento\Store\Model\StoreManagerInterface;
2123

2224
/**
2325
* Class Confirm
2426
*
2527
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2628
*/
27-
class Confirm extends \Magento\Customer\Controller\AbstractAccount
29+
class Confirm extends AbstractAccount implements HttpGetActionInterface
2830
{
2931
/**
3032
* @var \Magento\Framework\App\Config\ScopeConfigInterface
@@ -147,13 +149,16 @@ public function execute()
147149
$resultRedirect->setPath('*/*/');
148150
return $resultRedirect;
149151
}
150-
try {
151-
$customerId = $this->getRequest()->getParam('id', false);
152-
$key = $this->getRequest()->getParam('key', false);
153-
if (empty($customerId) || empty($key)) {
154-
throw new \Exception(__('Bad request.'));
155-
}
156152

153+
$customerId = $this->getRequest()->getParam('id', false);
154+
$key = $this->getRequest()->getParam('key', false);
155+
if (empty($customerId) || empty($key)) {
156+
$this->messageManager->addErrorMessage(__('Bad request.'));
157+
$url = $this->urlModel->getUrl('*/*/index', ['_secure' => true]);
158+
return $resultRedirect->setUrl($this->_redirect->error($url));
159+
}
160+
161+
try {
157162
// log in and send greeting email
158163
$customerEmail = $this->customerRepository->getById($customerId)->getEmail();
159164
$customer = $this->customerAccountManagement->activate($customerEmail, $key);

app/code/Magento/Customer/Controller/Adminhtml/Index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ protected function _addSessionErrorMessages($messages)
311311
protected function actUponMultipleCustomers(callable $singleAction, $customerIds)
312312
{
313313
if (!is_array($customerIds)) {
314-
$this->messageManager->addError(__('Please select customer(s).'));
314+
$this->messageManager->addErrorMessage(__('Please select customer(s).'));
315315
return 0;
316316
}
317317
$customersUpdated = 0;
@@ -320,7 +320,7 @@ protected function actUponMultipleCustomers(callable $singleAction, $customerIds
320320
$singleAction($customerId);
321321
$customersUpdated++;
322322
} catch (\Exception $exception) {
323-
$this->messageManager->addError($exception->getMessage());
323+
$this->messageManager->addErrorMessage($exception->getMessage());
324324
}
325325
}
326326
return $customersUpdated;

app/code/Magento/Customer/Controller/Adminhtml/Index/MassAssignGroup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected function massAction(AbstractCollection $collection)
6060
}
6161

6262
if ($customersUpdated) {
63-
$this->messageManager->addSuccess(__('A total of %1 record(s) were updated.', $customersUpdated));
63+
$this->messageManager->addSuccessMessage(__('A total of %1 record(s) were updated.', $customersUpdated));
6464
}
6565
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
6666
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);

app/code/Magento/Customer/Controller/Adminhtml/Index/MassDelete.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function massAction(AbstractCollection $collection)
5858
}
5959

6060
if ($customersDeleted) {
61-
$this->messageManager->addSuccess(__('A total of %1 record(s) were deleted.', $customersDeleted));
61+
$this->messageManager->addSuccessMessage(__('A total of %1 record(s) were deleted.', $customersDeleted));
6262
}
6363
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
6464
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);

app/code/Magento/Customer/Controller/Adminhtml/Index/MassSubscribe.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Customer\Controller\Adminhtml\Index;
77

88
use Magento\Backend\App\Action\Context;
9+
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
910
use Magento\Ui\Component\MassAction\Filter;
1011
use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory;
1112
use Magento\Customer\Api\CustomerRepositoryInterface;
@@ -16,7 +17,7 @@
1617
/**
1718
* Class MassSubscribe
1819
*/
19-
class MassSubscribe extends AbstractMassAction
20+
class MassSubscribe extends AbstractMassAction implements HttpPostActionInterface
2021
{
2122
/**
2223
* @var CustomerRepositoryInterface
@@ -64,7 +65,7 @@ protected function massAction(AbstractCollection $collection)
6465
}
6566

6667
if ($customersUpdated) {
67-
$this->messageManager->addSuccess(__('A total of %1 record(s) were updated.', $customersUpdated));
68+
$this->messageManager->addSuccessMessage(__('A total of %1 record(s) were updated.', $customersUpdated));
6869
}
6970
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
7071
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);

app/code/Magento/Customer/Controller/Adminhtml/Index/MassUnsubscribe.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Customer\Controller\Adminhtml\Index;
77

88
use Magento\Customer\Api\CustomerRepositoryInterface;
9+
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
910
use Magento\Framework\Controller\ResultFactory;
1011
use Magento\Backend\App\Action\Context;
1112
use Magento\Newsletter\Model\SubscriberFactory;
@@ -16,7 +17,7 @@
1617
/**
1718
* Class MassUnsubscribe
1819
*/
19-
class MassUnsubscribe extends AbstractMassAction
20+
class MassUnsubscribe extends AbstractMassAction implements HttpPostActionInterface
2021
{
2122
/**
2223
* @var CustomerRepositoryInterface
@@ -64,7 +65,7 @@ protected function massAction(AbstractCollection $collection)
6465
}
6566

6667
if ($customersUpdated) {
67-
$this->messageManager->addSuccess(__('A total of %1 record(s) were updated.', $customersUpdated));
68+
$this->messageManager->addSuccessMessage(__('A total of %1 record(s) were updated.', $customersUpdated));
6869
}
6970
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
7071
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);

app/code/Magento/Customer/Controller/Adminhtml/Index/ResetPassword.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ public function execute()
4444
\Magento\Customer\Model\AccountManagement::EMAIL_REMINDER,
4545
$customer->getWebsiteId()
4646
);
47-
$this->messageManager->addSuccess(__('The customer will receive an email with a link to reset password.'));
47+
$this->messageManager->addSuccessMessage(
48+
__('The customer will receive an email with a link to reset password.')
49+
);
4850
} catch (NoSuchEntityException $exception) {
4951
$resultRedirect->setPath('customer/index');
5052
return $resultRedirect;
@@ -57,7 +59,7 @@ public function execute()
5759
} catch (SecurityViolationException $exception) {
5860
$this->messageManager->addErrorMessage($exception->getMessage());
5961
} catch (\Exception $exception) {
60-
$this->messageManager->addException(
62+
$this->messageManager->addExceptionMessage(
6163
$exception,
6264
__('Something went wrong while resetting customer password.')
6365
);

0 commit comments

Comments
 (0)