BUGFIX: Fixed an aliasing problem when saving popup items, and a bug with when associating a new record with the parent ID associated with the field.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@67580 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Hayden Smith 2008-12-07 21:29:54 +00:00 committed by Sam Minnee
parent 0b0908f8a3
commit 884ad43916

View File

@ -460,7 +460,7 @@ JS;
if(!$childData->ID && $this->getParentClass()) { if(!$childData->ID && $this->getParentClass()) {
// make sure the relation-link is existing, even if we just add the sourceClass and didn't save it // make sure the relation-link is existing, even if we just add the sourceClass and didn't save it
$parentIDName = $this->getParentIdName( $this->getParentClass(), $this->sourceClass() ); $parentIDName = $this->getParentIdName( $this->getParentClass(), $this->sourceClass() );
$childData->$parentIDName = $childData->ID; $childData->$parentIDName = $this->sourceID();
} }
$detailFields = $this->getCustomFieldsFor($childData); $detailFields = $this->getCustomFieldsFor($childData);
@ -713,8 +713,10 @@ class ComplexTableField_ItemRequest extends RequestHandler {
* @see Form::ReferencedField * @see Form::ReferencedField
*/ */
function saveComplexTableField($data, $form, $request) { function saveComplexTableField($data, $form, $request) {
$form->saveInto($this->dataObj()); $dataObject = $this->dataObj();
$this->dataObj()->write();
$form->saveInto($dataObject);
$dataObject->write();
$closeLink = sprintf( $closeLink = sprintf(
'<small><a href="' . $_SERVER['HTTP_REFERER'] . '" onclick="javascript:window.top.GB_hide(); return false;">(%s)</a></small>', '<small><a href="' . $_SERVER['HTTP_REFERER'] . '" onclick="javascript:window.top.GB_hide(); return false;">(%s)</a></small>',
@ -722,8 +724,8 @@ class ComplexTableField_ItemRequest extends RequestHandler {
); );
$message = sprintf( $message = sprintf(
_t('ComplexTableField.SUCCESSEDIT', 'Saved %s %s %s'), _t('ComplexTableField.SUCCESSEDIT', 'Saved %s %s %s'),
$this->dataObj()->singular_name(), $dataObject->singular_name(),
'<a href="' . $this->Link() . '">"' . $this->dataObj()->Title . '"</a>', '<a href="' . $this->Link() . '">"' . $dataObject->Title . '"</a>',
$closeLink $closeLink
); );
$form->sessionMessage($message, 'good'); $form->sessionMessage($message, 'good');