From ab9c826ba268426a147cbd5d908c0a6bbfa31963 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 16 Jun 2009 03:05:15 +0000 Subject: [PATCH] BUGFIX: Fixed TableListField SQL generation so as not to add redundant duplicate columns. This builds on the change made in r50945, and keeps the behaviour the same as that, but note that r50945 removed the ability to include columns selected from a joined table, which was the original purpose of this code block. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79312 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/TableListField.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/forms/TableListField.php b/forms/TableListField.php index 172e33dea..ab40980dc 100755 --- a/forms/TableListField.php +++ b/forms/TableListField.php @@ -458,13 +458,6 @@ JS $query->select[] = "{$baseClass}.ClassName AS \"RecordClassName\""; } else { $query = singleton($this->sourceClass)->extendedSQL($this->sourceFilter(), $this->sourceSort, null, $this->sourceJoin); - - // Add more selected fields if they are from joined table. - foreach($this->FieldList() as $k => $title) { - if(!strpos($k, '.') && singleton($this->sourceClass)->hasDatabaseField($k)) { - $query->select[] = "\"$k\""; - } - } } if(isset($_REQUEST['ctf'][$this->Name()]['sort'])) { @@ -493,12 +486,6 @@ JS $query->select[] = "{$baseClass}.ClassName AS \"RecordClassName\""; } else { $query = singleton($this->sourceClass)->extendedSQL($this->sourceFilter(), $this->sourceSort, null, $this->sourceJoin); - - // Add more selected fields if they are from joined table. - foreach($this->FieldList() as $k=>$title){ - if(singleton($this->sourceClass)->hasDatabaseField($k)) - $query->select[] = "\"$k\""; - } } return clone $query; }