From bfff75e2c54a1ddc09695f6cf992d5abe011c88c Mon Sep 17 00:00:00 2001 From: Olga Nakonechna Date: Wed, 28 Sep 2016 17:34:40 +0300 Subject: [PATCH] MAGETWO-59047: [Github#6762] Start/End Dates added to Sale rule automatically #6762 --- .../SalesRule/Controller/Adminhtml/Promo/Quote/Save.php | 7 ++++++- .../SalesRule/Test/Constraint/AssertCartPriceRuleForm.php | 2 -- .../app/Magento/SalesRule/Test/Repository/SalesRule.xml | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php index 57477b5ce0623..efa45512acc83 100644 --- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php +++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php @@ -26,8 +26,13 @@ public function execute() ['request' => $this->getRequest()] ); $data = $this->getRequest()->getPostValue(); + + $filterValues = ['from_date' => $this->_dateFilter]; + if ($this->getRequest()->getParam('to_date')) { + $filterValues['to_date'] = $this->_dateFilter; + } $inputFilter = new \Zend_Filter_Input( - ['from_date' => $this->_dateFilter, 'to_date' => $this->_dateFilter], + $filterValues, [], $data ); diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleForm.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleForm.php index bfe0bc9eabddf..1f3f0e5a300b4 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleForm.php +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleForm.php @@ -25,8 +25,6 @@ class AssertCartPriceRuleForm extends AbstractConstraint protected $skippedFields = [ 'conditions_serialized', 'actions_serialized', - 'from_date', - 'to_date', 'rule_id' ]; diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Repository/SalesRule.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Repository/SalesRule.xml index 010b9d3233d16..63bab280a63b5 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Repository/SalesRule.xml +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Repository/SalesRule.xml @@ -114,10 +114,10 @@ 13 63 - 3/25/2014 + 03/25/2014 - 6/29/2024 + - 1 Yes