From 7ee0ad5fa6f5edf20b5c312351b75c876b996abb Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Mon, 4 Oct 2010 06:14:56 +0000 Subject: [PATCH] BUGFIX Using try/catch in MemberTableField->saveComplexTableField() similiar to parent implementation, which means trying to save a Member duplicate doesn't end up in a fatal error (fixes #5444) (from r103336) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@111662 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/MemberTableField.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/code/MemberTableField.php b/code/MemberTableField.php index 67e32cf2..dd5df1ee 100755 --- a/code/MemberTableField.php +++ b/code/MemberTableField.php @@ -352,8 +352,14 @@ class MemberTableField extends ComplexTableField { // Needs to write before saveInto() to ensure the 'Groups' TreeMultiselectField saves $childData->write(); - $form->saveInto($childData); - $childData->write(); + try { + $form->saveInto($childData); + $childData->write(); + } catch(ValidationException $e) { + var_dump($e->getResult()); + $form->sessionMessage($e->getResult()->message(), 'bad'); + return Director::redirectBack(); + } $closeLink = sprintf( '(%s)',