diff --git a/code/MemberTableField.php b/code/MemberTableField.php index 02d36e21..20d572fd 100755 --- a/code/MemberTableField.php +++ b/code/MemberTableField.php @@ -308,15 +308,12 @@ class MemberTableField extends ComplexTableField { function saveComplexTableField($data, $form, $params) { $className = $this->sourceClass(); $childData = new $className(); + + // Needs to write before saveInto() to ensure the 'Groups' TreeMultiselectField saves + $childData->write(); + $form->saveInto($childData); $childData->write(); - - // Only write group if no specific assignments have been set - if(isset($data['Groups']) && $data['Groups']) { - $childData->Groups()->setByIDList(explode(',', $data['Groups'])); - } else { - $childData->Groups()->add($data['GroupID']); - } $closeLink = sprintf( '(%s)', @@ -452,19 +449,6 @@ class MemberTableField_Item extends ComplexTableField_Item { class MemberTableField_ItemRequest extends ComplexTableField_ItemRequest { - function saveComplexTableField($data, $form, $request) { - parent::saveComplexTableField($data, $form, $request); - - $childData = $this->dataObj(); - - // Only write group if no specific assignments have been set - if(isset($data['Groups']) && $data['Groups']) { - $childData->Groups()->setByIDList(explode(',', $data['Groups'])); - } else { - $childData->Groups()->add($data['GroupID']); - } - } - /** * Deleting an item from a member table field should just remove that member from the group */ diff --git a/code/SecurityAdmin.php b/code/SecurityAdmin.php index 616b8f28..0d832f21 100644 --- a/code/SecurityAdmin.php +++ b/code/SecurityAdmin.php @@ -88,6 +88,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { ); // unset 'inlineadd' permission, we don't want inline addition $memberList->setPermissions(array('show', 'edit', 'delete', 'add')); + $memberList->setRelationAutoSetting(false); $fields = new FieldSet( new TabSet(