Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Commit 028f594

Browse files
authored
Merge pull request #4800 from magento-trigger/MC-20235
2 parents 83b0692 + 06ebc66 commit 028f594

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

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

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
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;
1615

1716
/**
1817
* Save action for catalog rule
@@ -26,27 +25,19 @@ class Save extends \Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog imple
2625
*/
2726
protected $dataPersistor;
2827

29-
/**
30-
* @var TimezoneInterface
31-
*/
32-
private $localeDate;
33-
3428
/**
3529
* @param Context $context
3630
* @param Registry $coreRegistry
3731
* @param Date $dateFilter
3832
* @param DataPersistorInterface $dataPersistor
39-
* @param TimezoneInterface $localeDate
4033
*/
4134
public function __construct(
4235
Context $context,
4336
Registry $coreRegistry,
4437
Date $dateFilter,
45-
DataPersistorInterface $dataPersistor,
46-
TimezoneInterface $localeDate
38+
DataPersistorInterface $dataPersistor
4739
) {
4840
$this->dataPersistor = $dataPersistor;
49-
$this->localeDate = $localeDate;
5041
parent::__construct($context, $coreRegistry, $dateFilter);
5142
}
5243

@@ -55,15 +46,16 @@ public function __construct(
5546
*
5647
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface|void
5748
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
58-
* @SuppressWarnings(PHPMD.NPathComplexity)
5949
*/
6050
public function execute()
6151
{
6252
if ($this->getRequest()->getPostValue()) {
53+
6354
/** @var \Magento\CatalogRule\Api\CatalogRuleRepositoryInterface $ruleRepository */
6455
$ruleRepository = $this->_objectManager->get(
6556
\Magento\CatalogRule\Api\CatalogRuleRepositoryInterface::class
6657
);
58+
6759
/** @var \Magento\CatalogRule\Model\Rule $model */
6860
$model = $this->_objectManager->create(\Magento\CatalogRule\Model\Rule::class);
6961

@@ -73,9 +65,7 @@ public function execute()
7365
['request' => $this->getRequest()]
7466
);
7567
$data = $this->getRequest()->getPostValue();
76-
if (!$this->getRequest()->getParam('from_date')) {
77-
$data['from_date'] = $this->localeDate->formatDate();
78-
}
68+
7969
$filterValues = ['from_date' => $this->_dateFilter];
8070
if ($this->getRequest()->getParam('to_date')) {
8171
$filterValues['to_date'] = $this->_dateFilter;

app/code/Magento/CatalogRule/Model/Indexer/ReindexRuleProduct.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ public function execute(Rule $rule, $batchCount, $useAdditionalTable = false)
101101
$scopeTz = new \DateTimeZone(
102102
$this->localeDate->getConfigTimezone(ScopeInterface::SCOPE_WEBSITE, $websiteId)
103103
);
104-
$fromTime = $rule->getFromDate()
105-
? (new \DateTime($rule->getFromDate(), $scopeTz))->getTimestamp()
106-
: 0;
104+
$fromTime = (new \DateTime($rule->getFromDate(), $scopeTz))->getTimestamp();
107105
$toTime = $rule->getToDate()
108106
? (new \DateTime($rule->getToDate(), $scopeTz))->getTimestamp() + IndexBuilder::SECONDS_IN_DAY - 1
109107
: 0;

0 commit comments

Comments
 (0)