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