From fb0401f36b7fc26c7ab040af601bc4e709176594 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Wed, 21 Sep 2022 00:08:53 +0100 Subject: [PATCH] MDL-75811 reportbuilder: concatenate using list seperator lang config. --- .../classes/local/aggregation/groupconcat.php | 3 ++- .../behat/columnaggregationeditor.feature | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/reportbuilder/classes/local/aggregation/groupconcat.php b/reportbuilder/classes/local/aggregation/groupconcat.php index 4cd07b47aba..d2bedae312c 100644 --- a/reportbuilder/classes/local/aggregation/groupconcat.php +++ b/reportbuilder/classes/local/aggregation/groupconcat.php @@ -138,6 +138,7 @@ class groupconcat extends base { $formattedvalues[] = parent::format_value($originalvalue, $originalvalues, $callbacks, $columntype); } - return implode(', ', $formattedvalues); + $listseparator = get_string('listsep', 'langconfig') . ' '; + return implode($listseparator, $formattedvalues); } } diff --git a/reportbuilder/tests/behat/columnaggregationeditor.feature b/reportbuilder/tests/behat/columnaggregationeditor.feature index 2eaaca32c06..b0129d4be6e 100644 --- a/reportbuilder/tests/behat/columnaggregationeditor.feature +++ b/reportbuilder/tests/behat/columnaggregationeditor.feature @@ -117,6 +117,27 @@ Feature: Manage custom report columns aggregation | Average | 0,7 | | Percentage | 66,7% | + Scenario Outline: Aggregated columns display localised list separators + Given the following "language customisations" exist: + | component | stringid | value | + | core_langconfig | listsep | ; | + And the following "core_reportbuilder > Reports" exist: + | name | source | default | + | My report | core_user\reportbuilder\datasource\users | 0 | + And the following "core_reportbuilder > Columns" exist: + | report | uniqueidentifier | + | My report | user:lastname | + | My report | user:firstname | + And I am on the "My report" "reportbuilder > Editor" page logged in as "admin" + And I change window size to "large" + When I set the "First name" column aggregation to "" + Then I should see "Aggregated column 'First name'" + And I should see "" in the "Richie" "table_row" + Examples: + | aggregation | output | + | Comma separated distinct values | Ben; Bill | + | Comma separated values | Ben; Bill; Bill | + Scenario: Show unique report rows Given the following "core_reportbuilder > Reports" exist: | name | source | default | uniquerows |