Skip to content

Commit 37f4013

Browse files
committed
Merge remote-tracking branch 'mainline/2.3-develop' into RE-develop-pr
2 parents f65d516 + fd076ae commit 37f4013

File tree

98 files changed

+382
-254
lines changed

Some content is hidden

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

98 files changed

+382
-254
lines changed

app/code/Magento/Backend/Block/Dashboard/Bar.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@ public function getTotals()
3838
*/
3939
public function addTotal($label, $value, $isQuantity = false)
4040
{
41-
/*if (!$isQuantity) {
42-
$value = $this->format($value);
43-
$decimals = substr($value, -2);
44-
$value = substr($value, 0, -2);
45-
} else {
46-
$value = ($value != '')?$value:0;
47-
$decimals = '';
48-
}*/
4941
if (!$isQuantity) {
5042
$value = $this->format($value);
5143
}

app/code/Magento/Bundle/Test/Mftf/Test/AdminRemoveDefaultImageBundleProductTest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@
7474
<!-- Remove image from product -->
7575
<actionGroup ref="removeProductImage" stepKey="removeProductImage"/>
7676

77-
<!-- Skip success message check when saving product because of bug MAGETWO-91177 -->
78-
<!-- actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/-->
79-
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProductFormAfterRemove"/>
77+
<actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/>
8078

8179
<!-- Assert product image not in admin product form -->
8280
<actionGroup ref="assertProductImageNotInAdminProductPage" stepKey="assertProductImageNotInAdminProductPage"/>

app/code/Magento/Captcha/Observer/CheckGuestCheckoutObserver.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,14 @@ public function execute(\Magento\Framework\Event\Observer $observer)
6666
$formId = 'guest_checkout';
6767
$captchaModel = $this->_helper->getCaptcha($formId);
6868
$checkoutMethod = $this->_typeOnepage->getQuote()->getCheckoutMethod();
69-
if ($checkoutMethod == \Magento\Checkout\Model\Type\Onepage::METHOD_GUEST) {
70-
if ($captchaModel->isRequired()) {
71-
$controller = $observer->getControllerAction();
72-
if (!$captchaModel->isCorrect($this->captchaStringResolver->resolve($controller->getRequest(), $formId))
73-
) {
74-
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
75-
$result = ['error' => 1, 'message' => __('Incorrect CAPTCHA')];
76-
$controller->getResponse()->representJson($this->jsonHelper->jsonEncode($result));
77-
}
69+
if ($checkoutMethod == \Magento\Checkout\Model\Type\Onepage::METHOD_GUEST
70+
&& $captchaModel->isRequired()
71+
) {
72+
$controller = $observer->getControllerAction();
73+
if (!$captchaModel->isCorrect($this->captchaStringResolver->resolve($controller->getRequest(), $formId))) {
74+
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
75+
$result = ['error' => 1, 'message' => __('Incorrect CAPTCHA')];
76+
$controller->getResponse()->representJson($this->jsonHelper->jsonEncode($result));
7877
}
7978
}
8079

app/code/Magento/Captcha/Observer/CheckRegisterCheckoutObserver.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,14 @@ public function execute(\Magento\Framework\Event\Observer $observer)
6666
$formId = 'register_during_checkout';
6767
$captchaModel = $this->_helper->getCaptcha($formId);
6868
$checkoutMethod = $this->_typeOnepage->getQuote()->getCheckoutMethod();
69-
if ($checkoutMethod == \Magento\Checkout\Model\Type\Onepage::METHOD_REGISTER) {
70-
if ($captchaModel->isRequired()) {
71-
$controller = $observer->getControllerAction();
72-
if (!$captchaModel->isCorrect($this->captchaStringResolver->resolve($controller->getRequest(), $formId))
73-
) {
74-
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
75-
$result = ['error' => 1, 'message' => __('Incorrect CAPTCHA')];
76-
$controller->getResponse()->representJson($this->jsonHelper->jsonEncode($result));
77-
}
69+
if ($checkoutMethod == \Magento\Checkout\Model\Type\Onepage::METHOD_REGISTER
70+
&& $captchaModel->isRequired()
71+
) {
72+
$controller = $observer->getControllerAction();
73+
if (!$captchaModel->isCorrect($this->captchaStringResolver->resolve($controller->getRequest(), $formId))) {
74+
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
75+
$result = ['error' => 1, 'message' => __('Incorrect CAPTCHA')];
76+
$controller->getResponse()->representJson($this->jsonHelper->jsonEncode($result));
7877
}
7978
}
8079

app/code/Magento/Captcha/Observer/CheckUserForgotPasswordBackendObserver.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,17 @@ public function execute(\Magento\Framework\Event\Observer $observer)
6969
$controller = $observer->getControllerAction();
7070
$email = (string)$observer->getControllerAction()->getRequest()->getParam('email');
7171
$params = $observer->getControllerAction()->getRequest()->getParams();
72-
if (!empty($email) && !empty($params)) {
73-
if ($captchaModel->isRequired()) {
74-
if (!$captchaModel->isCorrect($this->captchaStringResolver->resolve($controller->getRequest(), $formId))
75-
) {
76-
$this->_session->setEmail((string)$controller->getRequest()->getPost('email'));
77-
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
78-
$this->messageManager->addError(__('Incorrect CAPTCHA'));
79-
$controller->getResponse()->setRedirect(
80-
$controller->getUrl('*/*/forgotpassword', ['_nosecret' => true])
81-
);
82-
}
83-
}
72+
if (!empty($email)
73+
&& !empty($params)
74+
&& $captchaModel->isRequired()
75+
&& !$captchaModel->isCorrect($this->captchaStringResolver->resolve($controller->getRequest(), $formId))
76+
) {
77+
$this->_session->setEmail((string)$controller->getRequest()->getPost('email'));
78+
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
79+
$this->messageManager->addError(__('Incorrect CAPTCHA'));
80+
$controller->getResponse()->setRedirect(
81+
$controller->getUrl('*/*/forgotpassword', ['_nosecret' => true])
82+
);
8483
}
8584

8685
return $this;

app/code/Magento/Captcha/Observer/CheckUserLoginBackendObserver.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ public function execute(\Magento\Framework\Event\Observer $observer)
5252
$formId = 'backend_login';
5353
$captchaModel = $this->_helper->getCaptcha($formId);
5454
$login = $observer->getEvent()->getUsername();
55-
if ($captchaModel->isRequired($login)) {
56-
if (!$captchaModel->isCorrect($this->captchaStringResolver->resolve($this->_request, $formId))) {
57-
$captchaModel->logAttempt($login);
58-
throw new PluginAuthenticationException(__('Incorrect CAPTCHA.'));
59-
}
55+
if ($captchaModel->isRequired($login)
56+
&& !$captchaModel->isCorrect($this->captchaStringResolver->resolve($this->_request, $formId))
57+
) {
58+
$captchaModel->logAttempt($login);
59+
throw new PluginAuthenticationException(__('Incorrect CAPTCHA.'));
6060
}
6161
$captchaModel->logAttempt($login);
6262

app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function getElementHtml()
102102
*/
103103
public function getImages()
104104
{
105-
return $this->registry->registry('current_product')->getData('media_gallery') ?: null;
105+
return $this->getDataObject()->getData('media_gallery') ?: null;
106106
}
107107

108108
/**

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ public function execute()
9292
$attributeSet->setEntityTypeId($this->_entityTypeId)->load($setName, 'attribute_set_name');
9393
if ($attributeSet->getId()) {
9494
$setName = $this->_objectManager->get(\Magento\Framework\Escaper::class)->escapeHtml($setName);
95-
$this->messageManager->addError(
96-
__('A "%1" attribute set name already exists. Create a new name and try again.', $setName)
97-
);
95+
$this->messageManager->addErrorMessage(__('An attribute set named \'%1\' already exists.', $setName));
9896

9997
$layout = $this->layoutFactory->create();
10098
$layout->initMessages();

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,12 @@ public function execute()
6464
$this->productRepository->delete($product);
6565
$productDeleted++;
6666
}
67-
$this->messageManager->addSuccess(
68-
__('A total of %1 record(s) have been deleted.', $productDeleted)
69-
);
67+
68+
if ($productDeleted) {
69+
$this->messageManager->addSuccessMessage(
70+
__('A total of %1 record(s) have been deleted.', $productDeleted)
71+
);
72+
}
7073

7174
return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)->setPath('catalog/*/index');
7275
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ private function handleImageRemoveError($postData, $productId)
204204
if ($removedImagesAmount) {
205205
$expectedImagesAmount = count($postData['product']['media_gallery']['images']) - $removedImagesAmount;
206206
$product = $this->productRepository->getById($productId);
207-
if ($expectedImagesAmount != count($product->getMediaGallery('images'))) {
207+
$images = $product->getMediaGallery('images');
208+
if (is_array($images) && $expectedImagesAmount != count($images)) {
208209
$this->messageManager->addNoticeMessage(
209210
__('The image cannot be removed as it has been assigned to the other image role')
210211
);

0 commit comments

Comments
 (0)