Skip to content

Commit 35f317b

Browse files
committed
MC-19873: [Sample Data Function Test] Sample data test failed with Incorrect final price
1 parent 1d284ef commit 35f317b

File tree

1 file changed

+13
-1
lines changed
  • app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog

1 file changed

+13
-1
lines changed

app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Save.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Framework\Registry;
1313
use Magento\Framework\Stdlib\DateTime\Filter\Date;
1414
use Magento\Framework\App\Request\DataPersistorInterface;
15+
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
1516

1617
/**
1718
* Save action for catalog rule
@@ -25,19 +26,27 @@ class Save extends \Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog imple
2526
*/
2627
protected $dataPersistor;
2728

29+
/**
30+
* @var TimezoneInterface
31+
*/
32+
private $localeDate;
33+
2834
/**
2935
* @param Context $context
3036
* @param Registry $coreRegistry
3137
* @param Date $dateFilter
3238
* @param DataPersistorInterface $dataPersistor
39+
* @param TimezoneInterface $localeDate
3340
*/
3441
public function __construct(
3542
Context $context,
3643
Registry $coreRegistry,
3744
Date $dateFilter,
38-
DataPersistorInterface $dataPersistor
45+
DataPersistorInterface $dataPersistor,
46+
TimezoneInterface $localeDate
3947
) {
4048
$this->dataPersistor = $dataPersistor;
49+
$this->localeDate = $localeDate;
4150
parent::__construct($context, $coreRegistry, $dateFilter);
4251
}
4352

@@ -66,6 +75,9 @@ public function execute()
6675
);
6776
$data = $this->getRequest()->getPostValue();
6877

78+
if (!$this->getRequest()->getParam('from_date')) {
79+
$data['from_date'] = $this->localeDate->formatDate();
80+
}
6981
$filterValues = ['from_date' => $this->_dateFilter];
7082
if ($this->getRequest()->getParam('to_date')) {
7183
$filterValues['to_date'] = $this->_dateFilter;

0 commit comments

Comments
 (0)