BUGFIX: Fixed bug in getCMSFields scaffolding of relations

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63739 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-10-07 04:03:24 +00:00
parent ce42fd3f26
commit 09cbef9146

View File

@ -1202,7 +1202,7 @@ class DataObject extends ViewableData implements DataObjectInterface {
*/
protected function addScaffoldRelationFields($fieldSet) {
// make sure we have a tabset
if($this->has_many() || $this->many_many()) {
if(($this->has_many() || $this->many_many()) && !$fieldSet->fieldByName('Root')) {
$oldFields = $fieldSet;
$fieldSet = new FieldSet(new TabSet("Root", new Tab("Main")));
foreach($oldFields as $field) {
@ -1587,7 +1587,7 @@ class DataObject extends ViewableData implements DataObjectInterface {
// If we don't have an ID, then relation fields don't work
if($this->ID) {
$this->addScaffoldRelationFields($tabbedFields);
$tabbedFields = $this->addScaffoldRelationFields($tabbedFields);
}
$this->extend('updateCMSFields', $tabbedFields);