Skip to content

Commit 456d03b

Browse files
Merge branch 'AC-2571' into 2.4.5-bugfixes-050922
2 parents d876159 + 7e6b2f9 commit 456d03b

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66
*/
77
namespace Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog;
88

9+
use Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog as CatalogAction;
910
use Magento\Framework\App\Action\HttpGetActionInterface;
1011
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
1112
use Magento\Rule\Model\Condition\AbstractCondition;
12-
use Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog as CatalogAction;
13+
use Magento\Rule\Model\Condition\ConditionInterface;
1314

1415
class NewConditionHtml extends CatalogAction implements HttpPostActionInterface, HttpGetActionInterface
1516
{
1617
/**
18+
* New condition html action
19+
*
1720
* @return void
1821
*/
1922
public function execute()
@@ -23,6 +26,12 @@ public function execute()
2326
$typeArr = explode('|', str_replace('-', '/', $this->getRequest()->getParam('type')));
2427
$type = $typeArr[0];
2528

29+
if (class_exists($type) && !in_array(ConditionInterface::class, class_implements($type))) {
30+
$html = '';
31+
$this->getResponse()->setBody($html);
32+
return;
33+
}
34+
2635
$model = $this->_objectManager->create($type)
2736
->setId($id)
2837
->setType($type)

app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/NewConditionHtml.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Framework\App\Action\HttpPostActionInterface;
99
use Magento\Rule\Model\Condition\AbstractCondition;
10+
use Magento\Rule\Model\Condition\ConditionInterface;
1011
use Magento\SalesRule\Controller\Adminhtml\Promo\Quote;
1112

1213
/**
@@ -26,6 +27,12 @@ public function execute()
2627
$typeArr = explode('|', str_replace('-', '/', $this->getRequest()->getParam('type')));
2728
$type = $typeArr[0];
2829

30+
if (class_exists($type) && !in_array(ConditionInterface::class, class_implements($type))) {
31+
$html = '';
32+
$this->getResponse()->setBody($html);
33+
return;
34+
}
35+
2936
$model = $this->_objectManager->create(
3037
$type
3138
)->setId(

0 commit comments

Comments
 (0)