[php8-compact] Fix APIv4 Group Concat Test by setting dataType to be NULL if the...
authorSeamus Lee <seamuslee001@gmail.com>
Fri, 18 Jun 2021 06:32:59 +0000 (06:32 +0000)
committerSeamus Lee <seamuslee001@gmail.com>
Fri, 18 Jun 2021 21:12:08 +0000 (21:12 +0000)
Civi/Api4/Query/SqlFunctionGROUP_CONCAT.php

index 1b52b941b5faaf23150bc720dcb2ee6d78e2cbe2..0e0f7525b8bad3084a8a92aa9c6e80da1fd2557d 100644 (file)
@@ -59,6 +59,10 @@ class SqlFunctionGROUP_CONCAT extends SqlFunction {
     // By default, values are split into an array and formatted according to the field's dataType
     if (!$exprArgs[2]['prefix']) {
       $value = explode(\CRM_Core_DAO::VALUE_SEPARATOR, $value);
+      // If the first expression is another sqlFunction then unset $dataType to preserve raw string
+      if ($exprArgs[0]['expr'][0] instanceof SqlFunction) {
+        $dataType = NULL;
+      }
     }
     // If using custom separator, unset $dataType to preserve raw string
     else {