Merge pull request #446 from ss23/438_fix

Change CSV field export order to match form order - Fix #438
This commit is contained in:
Daniel Hensby 2016-03-21 12:18:13 +00:00
commit 3e3f4a7234

View File

@ -165,11 +165,12 @@ class UserDefinedForm extends Page {
// get a list of all field names and values used for print and export CSV views of the GridField below.
$columnSQL = <<<SQL
SELECT "Name", "Title"
SELECT "SubmittedFormField"."Name" as "Name", "SubmittedFormField"."Title" as "Title", IFNULL("EditableFormField"."Sort", 999) AS "Sort"
FROM "SubmittedFormField"
LEFT JOIN "SubmittedForm" ON "SubmittedForm"."ID" = "SubmittedFormField"."ParentID"
LEFT JOIN "EditableFormField" ON "EditableFormField"."Title" = "SubmittedFormField"."Title" AND "EditableFormField"."ParentID" = '$parentID'
WHERE "SubmittedForm"."ParentID" = '$parentID'
ORDER BY "Title" ASC
ORDER BY "Sort", "Title"
SQL;
// Sanitise periods in title
$columns = array();