Skip to content

Commit 2e346ee

Browse files
authored
Merge branch '2.4-develop' into baudeval-patch-1
2 parents 60c406d + 3920c2b commit 2e346ee

File tree

10 files changed

+241
-63
lines changed

10 files changed

+241
-63
lines changed

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

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,23 @@
66

77
namespace Magento\AsynchronousOperations\Controller\Adminhtml\Index;
88

9-
class Index extends \Magento\Backend\App\Action
9+
use Magento\Backend\App\Action;
10+
use Magento\Backend\App\Action\Context;
11+
use Magento\Framework\App\Action\HttpGetActionInterface;
12+
use Magento\Framework\View\Result\Page;
13+
use Magento\Framework\View\Result\PageFactory;
14+
15+
class Index extends Action implements HttpGetActionInterface
1016
{
1117
/**
1218
* Authorization level of a basic admin session
1319
*
1420
* @see _isAllowed()
1521
*/
16-
const ADMIN_RESOURCE = 'Magento_Logging::system_magento_logging_bulk_operations';
22+
public const ADMIN_RESOURCE = 'Magento_Logging::system_magento_logging_bulk_operations';
1723

1824
/**
19-
* @var \Magento\Framework\View\Result\PageFactory
25+
* @var PageFactory
2026
*/
2127
private $resultPageFactory;
2228

@@ -26,33 +32,24 @@ class Index extends \Magento\Backend\App\Action
2632
private $menuId;
2733

2834
/**
29-
* Details constructor.
30-
* @param \Magento\Backend\App\Action\Context $context
31-
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
35+
* @param Context $context
36+
* @param PageFactory $resultPageFactory
3237
* @param string $menuId
3338
*/
3439
public function __construct(
35-
\Magento\Backend\App\Action\Context $context,
36-
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
40+
Context $context,
41+
PageFactory $resultPageFactory,
3742
$menuId = 'Magento_AsynchronousOperations::system_magento_logging_bulk_operations'
3843
) {
3944
$this->resultPageFactory = $resultPageFactory;
4045
$this->menuId = $menuId;
4146
parent::__construct($context);
4247
}
4348

44-
/**
45-
* @inheritDoc
46-
*/
47-
protected function _isAllowed()
48-
{
49-
return parent::_isAllowed();
50-
}
51-
5249
/**
5350
* Bulk list action
5451
*
55-
* @return \Magento\Framework\View\Result\Page
52+
* @return Page
5653
*/
5754
public function execute()
5855
{

app/code/Magento/Catalog/Observer/SetSpecialPriceStartDate.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ public function execute(\Magento\Framework\Event\Observer $observer)
3939
/** @var $product \Magento\Catalog\Model\Product */
4040
$product = $observer->getEvent()->getProduct();
4141
if ($product->getSpecialPrice() && $product->getSpecialFromDate() === null) {
42-
$product->setData('special_from_date', $this->localeDate->date()->setTime(0, 0));
42+
// Set the special_from_date to the current date with time 00:00:00 when a special price is defined
43+
// but no start date is specified. This ensures the special price takes effect immediately
44+
// and is consistent with how the special price validation works in Magento.
45+
// The time is explicitly set to midnight to ensure the special price is active for the entire day.
46+
$product->setData(
47+
'special_from_date',
48+
$this->localeDate->date()->setTime(0, 0)->format('Y-m-d H:i:s')
49+
);
4350
}
4451
return $this;
4552
}

app/code/Magento/Catalog/Test/Unit/Observer/SetSpecialPriceStartDateTest.php

Lines changed: 84 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ protected function setUp(): void
8888
}
8989

9090
/**
91-
* Test observer execute method
91+
* Test observer execute method when special_from_date is null
9292
*/
9393
public function testExecuteModifySpecialFromDate(): void
9494
{
9595
$specialPrice = 15;
9696
$specialFromDate = null;
97-
$localeDateMock = ['special_from_date' => $this->returnValue($this->dateObject)];
97+
$formattedDate = '2023-01-01 00:00:00';
9898

9999
$this->observerMock
100100
->expects($this->once())
@@ -106,10 +106,18 @@ public function testExecuteModifySpecialFromDate(): void
106106
->method('getProduct')
107107
->willReturn($this->productMock);
108108

109-
$this->dateObject->expects($this->any())
109+
$this->dateObject
110+
->expects($this->once())
110111
->method('setTime')
112+
->with(0, 0)
111113
->willReturnSelf();
112114

115+
$this->dateObject
116+
->expects($this->once())
117+
->method('format')
118+
->with('Y-m-d H:i:s')
119+
->willReturn($formattedDate);
120+
113121
$this->timezone
114122
->expects($this->once())
115123
->method('date')
@@ -128,7 +136,79 @@ public function testExecuteModifySpecialFromDate(): void
128136
$this->productMock
129137
->expects($this->once())
130138
->method('setData')
131-
->willReturn($localeDateMock);
139+
->with('special_from_date', $formattedDate);
140+
141+
$this->observer->execute($this->observerMock);
142+
}
143+
144+
/**
145+
* Test observer doesn't modify special_from_date when it's already set
146+
*/
147+
public function testExecuteDoesNotModifyExistingSpecialFromDate(): void
148+
{
149+
$specialPrice = 15;
150+
$existingSpecialFromDate = '2023-01-01 00:00:00';
151+
152+
$this->observerMock
153+
->expects($this->once())
154+
->method('getEvent')
155+
->willReturn($this->eventMock);
156+
157+
$this->eventMock
158+
->expects($this->once())
159+
->method('getProduct')
160+
->willReturn($this->productMock);
161+
162+
$this->productMock
163+
->expects($this->once())
164+
->method('getSpecialPrice')
165+
->willReturn($specialPrice);
166+
167+
$this->productMock
168+
->expects($this->once())
169+
->method('getSpecialFromDate')
170+
->willReturn($existingSpecialFromDate);
171+
172+
$this->productMock
173+
->expects($this->never())
174+
->method('setData');
175+
176+
$this->timezone
177+
->expects($this->never())
178+
->method('date');
179+
180+
$this->observer->execute($this->observerMock);
181+
}
182+
183+
/**
184+
* Test observer doesn't set special_from_date when special price is not set
185+
*/
186+
public function testExecuteDoesNotSetSpecialFromDateWithoutSpecialPrice(): void
187+
{
188+
$specialPrice = null;
189+
190+
$this->observerMock
191+
->expects($this->once())
192+
->method('getEvent')
193+
->willReturn($this->eventMock);
194+
195+
$this->eventMock
196+
->expects($this->once())
197+
->method('getProduct')
198+
->willReturn($this->productMock);
199+
200+
$this->productMock
201+
->expects($this->once())
202+
->method('getSpecialPrice')
203+
->willReturn($specialPrice);
204+
205+
$this->productMock
206+
->expects($this->never())
207+
->method('getSpecialFromDate');
208+
209+
$this->productMock
210+
->expects($this->never())
211+
->method('setData');
132212

133213
$this->observer->execute($this->observerMock);
134214
}

app/code/Magento/Config/etc/system_file.xsd

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2012 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
@@ -178,7 +178,7 @@
178178
<xs:sequence>
179179
<xs:choice minOccurs="0" maxOccurs="unbounded">
180180
<xs:element name="label" type="xs:string" />
181-
<xs:element ref="comment" />
181+
<xs:element name="comment" type="commentType" minOccurs="0" />
182182
<xs:element name="tooltip" type="xs:string" />
183183
<xs:element name="hint" type="xs:string" />
184184
<xs:element name="frontend_class" type="xs:string" />
@@ -479,20 +479,12 @@
479479
</xs:restriction>
480480
</xs:simpleType>
481481

482-
<xs:element name="comment">
483-
<xs:annotation>
484-
<xs:documentation>
485-
Comment type
486-
</xs:documentation>
487-
</xs:annotation>
488-
489-
<xs:complexType mixed="true">
490-
<xs:sequence>
491-
<xs:any minOccurs="0" maxOccurs="1" processContents="lax" />
492-
</xs:sequence>
493-
<xs:attributeGroup ref="commentAttributeGroup"/>
494-
</xs:complexType>
495-
</xs:element>
482+
<xs:complexType name="commentType" mixed="true">
483+
<xs:sequence>
484+
<xs:element name="model" type="typeModel" minOccurs="0"/>
485+
</xs:sequence>
486+
<xs:attribute name="model" type="xs:string" use="optional"/>
487+
</xs:complexType>
496488

497489
<xs:simpleType name="typeConfigPath">
498490
<xs:annotation>

app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Composite/Fieldset/Configurable.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<?php
22
/**
3-
* Adminhtml block for fieldset of configurable product
4-
*
5-
* Copyright © Magento, Inc. All rights reserved.
6-
* See COPYING.txt for license details.
3+
* Copyright 2013 Adobe
4+
* All Rights Reserved.
75
*/
86
namespace Magento\ConfigurableProduct\Block\Adminhtml\Product\Composite\Fieldset;
97

@@ -101,7 +99,7 @@ public function getCurrentStore()
10199
}
102100

103101
/**
104-
* Returns additional values for js config, con be overridden by descendants
102+
* Returns additional values for js config, can be overridden by descendants
105103
*
106104
* @return array
107105
*/

app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public function getCurrentStore()
203203
}
204204

205205
/**
206-
* Returns additional values for js config, con be overridden by descendants
206+
* Returns additional values for js config, can be overridden by descendants
207207
*
208208
* @return array
209209
*/

app/code/Magento/Sales/Block/Adminhtml/Order/Create/Newsletter.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
* @api
1212
* @since 100.0.2
1313
*/
14-
class Newsletter extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate
14+
class Newsletter extends AbstractCreate
1515
{
1616
/**
17-
* Constructor
18-
*
19-
* @return void
17+
* @inheritdoc
2018
*/
2119
protected function _construct()
2220
{
@@ -43,13 +41,4 @@ public function getHeaderCssClass()
4341
{
4442
return 'head-newsletter-list';
4543
}
46-
47-
/**
48-
* @inheritdoc
49-
* phpcs:disable
50-
*/
51-
protected function _toHtml()
52-
{
53-
return parent::_toHtml();
54-
}
5544
}

0 commit comments

Comments
 (0)