From 9c4552efa35cea6c330c76efdbcf5f2349aac880 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Fri, 16 Jan 2009 00:54:55 +0000 Subject: [PATCH] MINOR Fixed undefined variable error in TableListField->generateExportFileData() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@70257 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/TableListField.php | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/forms/TableListField.php b/forms/TableListField.php index 531cea5d2..a51b35bf6 100755 --- a/forms/TableListField.php +++ b/forms/TableListField.php @@ -910,25 +910,21 @@ JS } } - /** - * the function is to generate string that will be used as - * the content of exported file - */ - - function generateExportFileData(&$numColumns, &$numRows){ + function generateExportFileData(&$numColumns, &$numRows) { $separator = $this->csvSeparator; $csvColumns = ($this->fieldListCsv) ? $this->fieldListCsv : $this->fieldList; - $fileData = ""; + $fileData = ''; + $columnData = array(); + $fieldItems = new DataObjectSet(); if($this->csvHasHeader) { - $fileData .= "\"" . implode("\"{$separator}\"",array_values($csvColumns)) . "\""; + $fileData .= "\"" . implode("\"{$separator}\"", array_values($csvColumns)) . "\""; $fileData .= "\n"; } - // get data - if(isset($this->customSourceItems)){ + if(isset($this->customSourceItems)) { $items = $this->customSourceItems; - }else{ + } else { $dataQuery = $this->getCsvQuery(); $records = $dataQuery->execute(); $sourceClass = $this->sourceClass; @@ -936,7 +932,6 @@ JS $items = $dataobject->buildDataObjectSet($records, 'DataObjectSet'); } - $fieldItems = new DataObjectSet(); if($items && $items->count()) foreach($items as $item) { // create a TableListField_Item to support resolving of // relation-fields in dot notation via TableListField_Item->Fields() @@ -949,10 +944,8 @@ JS if($fieldItems) { foreach($fieldItems as $fieldItem) { - $columnData = array(); $fields = $fieldItem->Fields(); - foreach($fields as $field) { - + if($fields) foreach($fields as $field) { $value = $field->Value; // TODO This should be replaced with casting