Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ENHANCEMENT Saving group relations on SecurityAdmin->EditForm()/RootF…

…orm() through TreeMultiselectField instead of hidden 'Group'/'GroupID' values

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@99579 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
commit ca3b8d5792c8ceda0d76bab0a5c92c47e89eb040 1 parent d68bbc2
@chillu chillu authored
Showing with 5 additions and 20 deletions.
  1. +4 −20 code/MemberTableField.php
  2. +1 −0  code/SecurityAdmin.php
View
24 code/MemberTableField.php
@@ -308,15 +308,12 @@ function AddRecordForm() {
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(
'<small><a href="' . $_SERVER['HTTP_REFERER'] . '" onclick="javascript:window.top.GB_hide(); return false;">(%s)</a></small>',
@@ -452,19 +449,6 @@ function Actions() {
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
*/
View
1  code/SecurityAdmin.php
@@ -88,6 +88,7 @@ function RootForm() {
);
// unset 'inlineadd' permission, we don't want inline addition
$memberList->setPermissions(array('show', 'edit', 'delete', 'add'));
+ $memberList->setRelationAutoSetting(false);
$fields = new FieldSet(
new TabSet(
Please sign in to comment.
Something went wrong with that request. Please try again.