Skip to content

Commit 127da1b

Browse files
author
Stanislav Idolov
committed
MAGETWO-70819: Widget with condition "special date to"
1 parent 8865957 commit 127da1b

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

app/code/Magento/Rule/Model/Condition/Sql/Builder.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,24 +116,26 @@ protected function _joinTablesToCollection(
116116
protected function _getMappedSqlCondition(AbstractCondition $condition, $value = '')
117117
{
118118
$argument = $condition->getMappedSqlField();
119-
if ($argument) {
120-
$conditionOperator = $condition->getOperatorForValidate();
121119

122-
if (!isset($this->_conditionOperatorMap[$conditionOperator])) {
123-
throw new \Magento\Framework\Exception\LocalizedException(__('Unknown condition operator'));
124-
}
120+
if (empty($argument)) {
121+
return $this->_expressionFactory->create(['expression' => '1 = -1']);
122+
}
125123

126-
$sql = str_replace(
127-
':field',
128-
$this->_connection->getIfNullSql($this->_connection->quoteIdentifier($argument), 0),
129-
$this->_conditionOperatorMap[$conditionOperator]
130-
);
124+
$conditionOperator = $condition->getOperatorForValidate();
131125

132-
return $this->_expressionFactory->create(
133-
['expression' => $value . $this->_connection->quoteInto($sql, $condition->getBindArgumentValue())]
134-
);
126+
if (!isset($this->_conditionOperatorMap[$conditionOperator])) {
127+
throw new \Magento\Framework\Exception\LocalizedException(__('Unknown condition operator'));
135128
}
136-
return '';
129+
130+
$sql = str_replace(
131+
':field',
132+
$this->_connection->getIfNullSql($this->_connection->quoteIdentifier($argument), 0),
133+
$this->_conditionOperatorMap[$conditionOperator]
134+
);
135+
136+
return $this->_expressionFactory->create(
137+
['expression' => $value . $this->_connection->quoteInto($sql, $condition->getBindArgumentValue())]
138+
);
137139
}
138140

139141
/**

0 commit comments

Comments
 (0)