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
This commit is contained in:
Sam Minnee 2009-06-16 03:05:15 +00:00
parent b536ecd610
commit ab9c826ba2

View File

@ -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;
}