Skip to content

Commit 10ab84e

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.4-develop
Accepted Community Pull Requests: - #26170: Fixed Special Price class not added in configurable product page (by @ravi-chandra3197) - #26173: Added Fix for 26164 (by @divyajyothi5321) - #25876: Advance the order state to processing when a capture notification is received (by @azambon) - #25125: Performance optimizations (by @andrey-legayev) - #25428: Fixed model save and ObjectManager usage (by @drpayyne) Fixed GitHub Issues: - #24972: Special Price class not added in configurable product page (reported by @k-edasi) has been fixed in #26170 by @ravi-chandra3197 in 2.4-develop branch Related commits: 1. 666d4c0 2. e037d51 - #26164: Underline should not display on hover for delete icon at shopping cart Internet explorer browser (reported by @hasim32) has been fixed in #26173 by @divyajyothi5321 in 2.4-develop branch Related commits: 1. 216d2c1 - #25659: Paypal Payments Pro IPN keeping payments marked as Pending Payment (reported by @quantumAV) has been fixed in #25876 by @azambon in 2.4-develop branch Related commits: 1. 45592e2
2 parents 34ef309 + a7ce2ae commit 10ab84e

File tree

12 files changed

+166
-53
lines changed

12 files changed

+166
-53
lines changed

app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,16 @@ protected function _getWebsiteCurrencyRates()
9797
);
9898
foreach ($this->_storeManager->getWebsites() as $website) {
9999
/* @var $website \Magento\Store\Model\Website */
100-
if ($website->getBaseCurrencyCode() != $baseCurrency) {
100+
$websiteBaseCurrency = $website->getBaseCurrencyCode();
101+
if ($websiteBaseCurrency !== $baseCurrency) {
101102
$rate = $this->_currencyFactory->create()->load(
102103
$baseCurrency
103-
)->getRate(
104-
$website->getBaseCurrencyCode()
105-
);
104+
)->getRate($websiteBaseCurrency);
106105
if (!$rate) {
107106
$rate = 1;
108107
}
109108
$this->_rates[$website->getId()] = [
110-
'code' => $website->getBaseCurrencyCode(),
109+
'code' => $websiteBaseCurrency,
111110
'rate' => $rate,
112111
];
113112
} else {
@@ -187,6 +186,7 @@ public function validate($object)
187186
}
188187
$compare = implode(
189188
'-',
189+
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
190190
array_merge(
191191
[$priceRow['website_id'], $priceRow['cust_group']],
192192
$this->_getAdditionalUniqueFields($priceRow)
@@ -210,6 +210,7 @@ public function validate($object)
210210
if ($price['website_id'] == 0) {
211211
$compare = implode(
212212
'-',
213+
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
213214
array_merge(
214215
[$price['website_id'], $price['cust_group']],
215216
$this->_getAdditionalUniqueFields($price)
@@ -234,6 +235,7 @@ public function validate($object)
234235

235236
$globalCompare = implode(
236237
'-',
238+
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
237239
array_merge([0, $priceRow['cust_group']], $this->_getAdditionalUniqueFields($priceRow))
238240
);
239241
$websiteCurrency = $rates[$priceRow['website_id']]['code'];
@@ -279,6 +281,7 @@ public function preparePriceData(array $priceData, $productTypeId, $websiteId)
279281
if (!array_filter($v)) {
280282
continue;
281283
}
284+
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
282285
$key = implode('-', array_merge([$v['cust_group']], $this->_getAdditionalUniqueFields($v)));
283286
if ($v['website_id'] == $websiteId) {
284287
$data[$key] = $v;

app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute implements
3838

3939
const KEY_IS_GLOBAL = 'is_global';
4040

41+
private const ALLOWED_INPUT_TYPES = [
42+
'boolean' => true,
43+
'date' => true,
44+
'datetime' => true,
45+
'multiselect' => true,
46+
'price' => true,
47+
'select' => true,
48+
'text' => true,
49+
'textarea' => true,
50+
'weight' => true,
51+
];
52+
4153
/**
4254
* @var LockValidatorInterface
4355
*/
@@ -403,18 +415,7 @@ public function getSourceModel()
403415
*/
404416
public function isAllowedForRuleCondition()
405417
{
406-
$allowedInputTypes = [
407-
'boolean',
408-
'date',
409-
'datetime',
410-
'multiselect',
411-
'price',
412-
'select',
413-
'text',
414-
'textarea',
415-
'weight',
416-
];
417-
return $this->getIsVisible() && in_array($this->getFrontendInput(), $allowedInputTypes);
418+
return $this->getIsVisible() && isset(self::ALLOWED_INPUT_TYPES[$this->getFrontendInput()]);
418419
}
419420

420421
/**

app/code/Magento/Email/Controller/Adminhtml/Email/Template/Save.php

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,63 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76
namespace Magento\Email\Controller\Adminhtml\Email\Template;
87

8+
use Exception;
9+
use Magento\Backend\App\Action\Context;
10+
use Magento\Backend\Model\Session;
11+
use Magento\Email\Controller\Adminhtml\Email\Template;
12+
use Magento\Email\Model\ResourceModel\Template as TemplateResource;
13+
use Magento\Framework\App\Action\HttpPostActionInterface;
14+
use Magento\Framework\App\ObjectManager;
915
use Magento\Framework\App\TemplateTypesInterface;
16+
use Magento\Framework\Registry;
17+
use Magento\Framework\Stdlib\DateTime\DateTime;
1018

11-
class Save extends \Magento\Email\Controller\Adminhtml\Email\Template
19+
/**
20+
* Save Controller
21+
*/
22+
class Save extends Template implements HttpPostActionInterface
1223
{
24+
/**
25+
* @var DateTime
26+
*/
27+
private $dateTime;
28+
29+
/**
30+
* @var TemplateResource
31+
*/
32+
private $templateResource;
33+
34+
/**
35+
* @var Session
36+
*/
37+
private $backendSession;
38+
39+
/**
40+
* Save constructor
41+
*
42+
* @param Context $context
43+
* @param Registry $coreRegistry
44+
* @param DateTime|null $dateTime
45+
* @param TemplateResource|null $templateResource
46+
* @param Session|null $backendSession
47+
*/
48+
public function __construct(
49+
Context $context,
50+
Registry $coreRegistry,
51+
DateTime $dateTime = null,
52+
TemplateResource $templateResource = null,
53+
Session $backendSession = null
54+
) {
55+
$this->dateTime = $dateTime ?: ObjectManager::getInstance()->get(DateTime::class);
56+
$this->templateResource = $templateResource ?: ObjectManager::getInstance()->get(TemplateResource::class);
57+
$this->backendSession = $backendSession ?: ObjectManager::getInstance()->get(Session::class);
58+
parent::__construct($context, $coreRegistry);
59+
}
60+
1361
/**
1462
* Save transactional email action
1563
*
@@ -18,10 +66,10 @@ class Save extends \Magento\Email\Controller\Adminhtml\Email\Template
1866
public function execute()
1967
{
2068
$request = $this->getRequest();
21-
$id = $this->getRequest()->getParam('id');
69+
$templateId = $this->getRequest()->getParam('id');
2270

2371
$template = $this->_initTemplate('id');
24-
if (!$template->getId() && $id) {
72+
if (!$template->getId() && $templateId) {
2573
$this->messageManager->addErrorMessage(__('This email template no longer exists.'));
2674
$this->_redirect('adminhtml/*/');
2775
return;
@@ -37,7 +85,7 @@ public function execute()
3785
)->setTemplateStyles(
3886
$request->getParam('template_styles')
3987
)->setModifiedAt(
40-
$this->_objectManager->get(\Magento\Framework\Stdlib\DateTime\DateTime::class)->gmtDate()
88+
$this->dateTime->gmtDate()
4189
)->setOrigTemplateCode(
4290
$request->getParam('orig_template_code')
4391
)->setOrigTemplateVariables(
@@ -53,17 +101,13 @@ public function execute()
53101
$template->setTemplateStyles('');
54102
}
55103

56-
$template->save();
57-
$this->_objectManager->get(\Magento\Backend\Model\Session::class)->setFormData(false);
104+
$this->templateResource->save($template);
105+
106+
$this->backendSession->setFormData(false);
58107
$this->messageManager->addSuccessMessage(__('You saved the email template.'));
59108
$this->_redirect('adminhtml/*');
60-
} catch (\Exception $e) {
61-
$this->_objectManager->get(
62-
\Magento\Backend\Model\Session::class
63-
)->setData(
64-
'email_template_form_data',
65-
$request->getParams()
66-
);
109+
} catch (Exception $e) {
110+
$this->backendSession->setData('email_template_form_data', $request->getParams());
67111
$this->messageManager->addErrorMessage($e->getMessage());
68112
$this->_forward('new');
69113
}

app/code/Magento/Sales/Model/Order/Payment/State/RegisterCaptureNotificationCommand.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
use Magento\Sales\Model\Order;
1212
use Magento\Sales\Model\Order\StatusResolver;
1313

14+
/**
15+
* Class RegisterCaptureNotificationCommand
16+
*
17+
* Command that Register Capture Notification
18+
*/
1419
class RegisterCaptureNotificationCommand implements CommandInterface
1520
{
1621
/**
@@ -23,19 +28,24 @@ class RegisterCaptureNotificationCommand implements CommandInterface
2328
*/
2429
public function __construct(StatusResolver $statusResolver = null)
2530
{
26-
$this->statusResolver = $statusResolver
27-
? : ObjectManager::getInstance()->get(StatusResolver::class);
31+
$this->statusResolver = $statusResolver ?: ObjectManager::getInstance()->get(StatusResolver::class);
2832
}
2933

3034
/**
35+
* Registers a capture event for this payment
36+
*
3137
* @param OrderPaymentInterface $payment
3238
* @param string|float|int $amount
3339
* @param OrderInterface $order
3440
* @return string
3541
*/
3642
public function execute(OrderPaymentInterface $payment, $amount, OrderInterface $order)
3743
{
38-
$state = $order->getState() ?: Order::STATE_PROCESSING;
44+
$state = $order->getState();
45+
if (!$state || $state === Order::STATE_NEW || $state === Order::STATE_PENDING_PAYMENT) {
46+
$state = Order::STATE_PROCESSING;
47+
}
48+
3949
$status = null;
4050
$message = 'Registered notification about captured amount of %1.';
4151

@@ -61,6 +71,8 @@ public function execute(OrderPaymentInterface $payment, $amount, OrderInterface
6171
}
6272

6373
/**
74+
* Sets the state and status of the order
75+
*
6476
* @deprecated 100.2.0 Replaced by a StatusResolver class call.
6577
*
6678
* @param Order $order

app/code/Magento/Sales/Test/Unit/Model/Order/Payment/State/RegisterCaptureNotificationCommandTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,22 @@ public function commandResultDataProvider()
8080
$this->newOrderStatus,
8181
'Registered notification about captured amount of %1.',
8282
],
83+
[
84+
false,
85+
false,
86+
Order::STATE_NEW,
87+
Order::STATE_PROCESSING,
88+
$this->newOrderStatus,
89+
'Registered notification about captured amount of %1.',
90+
],
91+
[
92+
false,
93+
false,
94+
Order::STATE_PENDING_PAYMENT,
95+
Order::STATE_PROCESSING,
96+
$this->newOrderStatus,
97+
'Registered notification about captured amount of %1.',
98+
],
8399
[
84100
true,
85101
false,

app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,8 @@ define([
952952

953953
isShow = typeof result != 'undefined' && result.oldPrice.amount !== result.finalPrice.amount;
954954

955+
$productPrice.find('span:first').toggleClass('special-price', isShow);
956+
955957
$product.find(this.options.slyOldPriceSelector)[isShow ? 'show' : 'hide']();
956958

957959
if (typeof result != 'undefined' && result.tierPrices && result.tierPrices.length) {

app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@
267267
.lib-icon-font-symbol(
268268
@_icon-font-content: @icon-trash
269269
);
270+
271+
&:hover {
272+
.lib-css(text-decoration, @link__text-decoration);
273+
}
270274
}
271275
}
272276

dev/tests/js/jasmine/tests/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ define([
2828
id: optionId
2929
}]
3030
};
31+
3132
widget.options = {
3233
classes: {
3334
optionClass: 'swatch-option'
@@ -50,6 +51,7 @@ define([
5051
}
5152
}
5253
};
54+
5355
optionConfig = widget.options.jsonSwatchConfig[attribute.id];
5456
html = $(widget._RenderSwatchOptions(attribute, 'option-label-control-id-1'))[0];
5557
});
@@ -76,5 +78,25 @@ define([
7678
expect(html.style.height).toEqual(swathImageHeight + 'px');
7779
expect(html.style.width).toEqual(swathImageWidth + 'px');
7880
});
81+
82+
it('check udate price method', function () {
83+
var productPriceMock = {
84+
find: jasmine.createSpy().and.returnValue({
85+
hide: jasmine.createSpy(),
86+
priceBox: jasmine.createSpy().and.returnValue(''),
87+
trigger: jasmine.createSpy(),
88+
find: jasmine.createSpy().and.returnValue({
89+
toggleClass: jasmine.createSpy()
90+
})
91+
})
92+
};
93+
94+
widget.element = {
95+
parents: jasmine.createSpy().and.returnValue(productPriceMock)
96+
};
97+
widget._getNewPrices = jasmine.createSpy().and.returnValue(undefined);
98+
widget._UpdatePrice();
99+
expect(productPriceMock.find().find.calls.count()).toBe(1);
100+
});
79101
});
80102
});

lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76
namespace Magento\Framework\App\ObjectManager\ConfigLoader;
87

98
use Magento\Framework\App\Filesystem\DirectoryList;
109
use Magento\Framework\ObjectManager\ConfigLoaderInterface;
11-
use Magento\Framework\Serialize\SerializerInterface;
12-
use Magento\Framework\Serialize\Serializer\Serialize;
1310

11+
/**
12+
* Load configuration files
13+
*/
1414
class Compiled implements ConfigLoaderInterface
1515
{
1616
/**
@@ -21,7 +21,7 @@ class Compiled implements ConfigLoaderInterface
2121
private $configCache = [];
2222

2323
/**
24-
* {inheritdoc}
24+
* @inheritdoc
2525
*/
2626
public function load($area)
2727
{

lib/internal/Magento/Framework/DB/Select/SelectRenderer.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@
88
use Magento\Framework\DB\Select;
99

1010
/**
11-
* Class SelectRenderer
11+
* Phrase renderer interface
1212
*/
1313
class SelectRenderer implements RendererInterface
1414
{
15+
private const MANDATORY_SELECT_PARTS = [
16+
Select::COLUMNS => true,
17+
Select::FROM => true
18+
];
19+
1520
/**
1621
* @var RendererInterface[]
1722
*/
@@ -67,7 +72,8 @@ public function render(Select $select, $sql = '')
6772
{
6873
$sql = Select::SQL_SELECT;
6974
foreach ($this->renderers as $renderer) {
70-
if (in_array($renderer['part'], [Select::COLUMNS, Select::FROM]) || $select->getPart($renderer['part'])) {
75+
$part = $renderer['part'];
76+
if (isset(self::MANDATORY_SELECT_PARTS[$part]) || $select->getPart($part)) {
7177
$sql = $renderer['renderer']->render($select, $sql);
7278
}
7379
}

0 commit comments

Comments
 (0)