Merged revisions 52875 via svnmerge from

http://svn.silverstripe.com/open/modules/cms/branches/govtsecurity

........
  r52875 | sminnee | 2008-04-16 20:12:35 +1200 (Wed, 16 Apr 2008) | 1 line
  
  Respect Member validation in the add-record part of MemberTableField
........


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@53457 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-04-26 06:28:33 +00:00
parent 0341a8685e
commit deaddc841d

View File

@ -218,6 +218,9 @@ class MemberTableField extends ComplexTableField {
$record = new $className();
$record->update($data);
$valid = $record->validate();
if($valid->valid()) {
$record->write();
// To Avoid duplication in the Group_Members table if the ComponentSet.php is not modified just uncomment le line below
@ -231,6 +234,10 @@ class MemberTableField extends ComplexTableField {
FormResponse::update_dom_id($this->id(), $this->renderWith($this->template), true);
FormResponse::status_message(_t('MemberTableField.ADDEDTOGROUP','Added member to group'), 'good');
} else {
FormResponse::status_message(Convert::raw2xml("I couldn't add that user to this group:\n\n" . $valid->starredlist()), 'bad');
}
return FormResponse::respond();
}
@ -387,8 +394,9 @@ class MemberTableField_Popup extends ComplexTableField_Popup {
// custom behaviour for MemberTableField: add member to current group
$childObject->Groups()->add($_REQUEST['GroupID']);
$form->sessionMessage("Changes saved.", 'good');
} else {
$form->sessionMessage($valid->message(), 'bad');
$form->sessionMessage(Convert::raw2xml("I couldn't save your changes:\n\n" . $valid->starredList()), 'bad');
}