mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 15:05:42 +00:00
Merge branch '6' into 7
This commit is contained in:
commit
5a15c904f0
@ -37,11 +37,12 @@ class EmailRecipientCondition extends DataObject
|
|||||||
'ValueLessThan' => 'Less than',
|
'ValueLessThan' => 'Less than',
|
||||||
'ValueLessThanEqual' => 'Less than or equal',
|
'ValueLessThanEqual' => 'Less than or equal',
|
||||||
'ValueGreaterThan' => 'Greater than',
|
'ValueGreaterThan' => 'Greater than',
|
||||||
'ValueGreaterThanEqual' => 'Greater than or equal'
|
'ValueGreaterThanEqual' => 'Greater than or equal',
|
||||||
|
'Includes' => 'Includes'
|
||||||
];
|
];
|
||||||
|
|
||||||
private static $db = [
|
private static $db = [
|
||||||
'ConditionOption' => 'Enum("IsBlank,IsNotBlank,Equals,NotEquals,ValueLessThan,ValueLessThanEqual,ValueGreaterThan,ValueGreaterThanEqual")',
|
'ConditionOption' => 'Enum("IsBlank,IsNotBlank,Equals,NotEquals,ValueLessThan,ValueLessThanEqual,ValueGreaterThan,ValueGreaterThanEqual,Includes")',
|
||||||
'ConditionValue' => 'Varchar'
|
'ConditionValue' => 'Varchar'
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -96,6 +97,11 @@ class EmailRecipientCondition extends DataObject
|
|||||||
$result = !($result);
|
$result = !($result);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'Includes':
|
||||||
|
$result = is_array($fieldValue)
|
||||||
|
? in_array($conditionValue, $fieldValue)
|
||||||
|
: stripos($fieldValue ?? '', $conditionValue) !== false;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new LogicException("Unhandled rule {$this->ConditionOption}");
|
throw new LogicException("Unhandled rule {$this->ConditionOption}");
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user