From a4d742dbf0f5203d070fb53e769a79e250305b6f Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 15 Mar 2023 15:36:16 -0400 Subject: [PATCH] SearchKit - Handle comma-separated values passed from aform url --- .../Civi/Api4/Action/SearchDisplay/AbstractRunAction.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ext/search_kit/Civi/Api4/Action/SearchDisplay/AbstractRunAction.php b/ext/search_kit/Civi/Api4/Action/SearchDisplay/AbstractRunAction.php index eba8bd5806..8017b91b07 100644 --- a/ext/search_kit/Civi/Api4/Action/SearchDisplay/AbstractRunAction.php +++ b/ext/search_kit/Civi/Api4/Action/SearchDisplay/AbstractRunAction.php @@ -806,7 +806,13 @@ abstract class AbstractRunAction extends \Civi\Api4\Generic\AbstractAction { if (!$filters) { return; } - + // Parse comma-separated values from filters passed through afform variables + // These values may have come from the url and should be transformed into arrays + foreach ($directiveFilters as $key) { + if (!empty($filters[$key]) && is_string($filters[$key]) && strpos($filters[$key], ',')) { + $filters[$key] = explode(',', $filters[$key]); + } + } // Add all filters to the WHERE or HAVING clause foreach ($filters as $key => $value) { $fieldNames = explode(',', $key); -- 2.25.1