Created
April 17, 2018 17:21
-
-
Save heathdutton/164d75d50cd43d9c77e45ab412f3fb53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/bundles/LeadBundle/Entity/LeadListRepository.php b/app/bundles/LeadBundle/Entity/LeadListRepository.php | |
index 8cdfbae108..234535214f 100644 | |
--- a/app/bundles/LeadBundle/Entity/LeadListRepository.php | |
+++ b/app/bundles/LeadBundle/Entity/LeadListRepository.php | |
@@ -1677,11 +1677,44 @@ public function getListFilterExpr($filters, &$parameters, QueryBuilder $q, $isNo | |
case 'in': | |
case 'notIn': | |
+ if (is_string($details['filter'])) { | |
+ // Expound the string to an array based on common string array notations. | |
+ foreach ([',', ';', "\t", ' '] as $delimiter) { | |
+ if (false !== strpos($details['filter'], $delimiter)) { | |
+ break; | |
+ } | |
+ } | |
+ foreach (["'", '"'] as $enclosure) { | |
+ if (false !== strpos($details['filter'], $enclosure)) { | |
+ break; | |
+ } | |
+ } | |
+ foreach (['"', '\\'] as $escape) { | |
+ if ($escape !== $enclosure && false !== strpos($details['filter'], $enclosure)) { | |
+ break; | |
+ } | |
+ } | |
+ foreach (["\r\n", "\n", "\r"] as $terminator) { | |
+ if (false !== strpos($details['filter'], $terminator)) { | |
+ break; | |
+ } | |
+ } | |
+ $lines = explode($terminator, $details['filter']); | |
+ $details['filter'] = []; | |
+ foreach ($lines as $line) { | |
+ foreach (str_getcsv($line, $delimiter, $enclosure, $escape) as $value) { | |
+ if ($value && 'NULL' !== $value) { | |
+ $details['filter'][] = $value; | |
+ } | |
+ } | |
+ } | |
+ } | |
foreach ($details['filter'] as &$value) { | |
$value = $q->expr()->literal( | |
InputHelper::clean($value) | |
); | |
} | |
if ($details['type'] == 'multiselect') { | |
foreach ($details['filter'] as $filter) { | |
$filter = trim($filter, "'"); | |
diff --git a/app/bundles/LeadBundle/Entity/OperatorListTrait.php b/app/bundles/LeadBundle/Entity/OperatorListTrait.php | |
index 156a6d8d5e..4fa8bb6ce5 100644 | |
--- a/app/bundles/LeadBundle/Entity/OperatorListTrait.php | |
+++ b/app/bundles/LeadBundle/Entity/OperatorListTrait.php | |
@@ -27,6 +27,8 @@ | |
'startsWith', | |
'endsWith', | |
'contains', | |
+ 'in', | |
+ '!in', | |
], | |
], | |
'select' => [ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment