From 071b310c64f14886a58865e32cfbaca6861fbd7b Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 8 Jan 2008 21:57:15 +0000 Subject: [PATCH] fixed getParentIdName() call in DetailForm() - paramter-order was wrong better checking in saveComplexTableField() to avoid PHP-notice git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@47740 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/ComplexTableField.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/forms/ComplexTableField.php b/forms/ComplexTableField.php index 4e1822573..dcfa5b29f 100755 --- a/forms/ComplexTableField.php +++ b/forms/ComplexTableField.php @@ -289,7 +289,7 @@ JS; } if($this->getParentClass()) { - $parentIdName = $this->getParentIdName($this->sourceClass,$this->getParentClass()); + $parentIdName = $this->getParentIdName($this->getParentClass(), $this->sourceClass); if(!$parentIdName) { user_error("ComplexTableField::DetailForm() Cannot automatically determine 'has-one'-relationship to parent, @@ -743,10 +743,8 @@ class ComplexTableField_Popup extends Form { * @see {Form::ReferencedField}). */ function saveComplexTableField() { - $id = Convert::raw2sql($_REQUEST['ctf']['childID']); - - if (is_numeric($id)) { - $childObject = DataObject::get_by_id($this->sourceClass, $id); + if(isset($_REQUEST['ctf']['childID']) && is_numeric($_REQUEST['ctf']['childID'])) { + $childObject = DataObject::get_by_id($this->sourceClass, $_REQUEST['ctf']['childID']); } else { $childObject = new $this->sourceClass(); $this->fields->removeByName('ID');