diff --git a/code/submissions/SubmittedFormReportField.php b/code/submissions/SubmittedFormReportField.php index 33ff652..90a4ad1 100755 --- a/code/submissions/SubmittedFormReportField.php +++ b/code/submissions/SubmittedFormReportField.php @@ -87,6 +87,7 @@ class SubmittedFormReportField extends FormField { FROM \"SubmittedFormField\" LEFT JOIN \"SubmittedForm\" ON \"SubmittedForm\".\"ID\" = \"SubmittedFormField\".\"ParentID\" WHERE \"SubmittedFormField\".\"ParentID\" IN (" . implode(',', $inClause) . ") + GROUP BY \"Name\" ORDER BY \"SubmittedFormField\".\"ID\""); // Sort the Names and Titles from the database query into separate keyed arrays @@ -95,10 +96,6 @@ class SubmittedFormReportField extends FormField { $csvHeaderTitle[] = $array['Title']; } - // We need Headers to be unique, query is returning headers multiple times (number of submissions). - // TODO: Fix query - $csvHeaderNames = array_unique($csvHeaderNames); - $csvHeaderTitle = array_unique($csvHeaderTitle); // For every submission... $i = 0; @@ -134,7 +131,10 @@ class SubmittedFormReportField extends FormField { // Loop over all the names we can use for($i=0;$i