From 7fbeb7d6c568b4a306d878d8104ecc152f8928df Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Fri, 3 Oct 2008 02:25:49 +0000 Subject: [PATCH] BUGFIX: Fixed ComplexTableField export git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63581 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/ComplexTableField.php | 7 +++++++ forms/TableListField.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/forms/ComplexTableField.php b/forms/ComplexTableField.php index f00de707b..d42b422e3 100755 --- a/forms/ComplexTableField.php +++ b/forms/ComplexTableField.php @@ -187,12 +187,19 @@ class ComplexTableField extends TableListField { */ function sourceFilter() { $sourceFilter = parent::sourceFilter(); + if($this->relationAutoSetting && $this->getParentClass() && ($filterKey = $this->getParentIdName($this->getParentClass(), $this->sourceClass())) && ($filterValue = $this->sourceID()) ) { $newFilter = "`$filterKey` = '" . Convert::raw2sql($filterValue) . "'"; + + if($sourceFilter && is_array($sourceFilter)) { + // Note that the brackets below are taken into account when building this + $sourceFilter = implode(") AND (", $sourceFilter); + } + $sourceFilter = $sourceFilter ? "($sourceFilter) AND ($newFilter)" : $newFilter; } return $sourceFilter; diff --git a/forms/TableListField.php b/forms/TableListField.php index b16a96896..7721ed0ea 100755 --- a/forms/TableListField.php +++ b/forms/TableListField.php @@ -926,7 +926,7 @@ JS } } - HTTP::sendFileToBrowser($fileData, $fileName); + return HTTPRequest::send_file($fileData, $fileName); } else { user_error("No records found", E_USER_ERROR); }