From c09e5186354a0fead3124c38fcb1110452b2964a Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 16 Sep 2007 15:06:05 +0000 Subject: [PATCH] elofgren: BUGFIX: Fix "Fatal error: Call to a member function Actions() on a non-object in LeftAndMain?.php on line 489" error encountered after creating a new page and clicking "Save & Publish". This bug was caused by r40178. (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42085 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/LeftAndMain.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index be47f91e..3266642e 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -487,11 +487,9 @@ JS; if (isset($urlParams['publish']) && $urlParams['publish'] == 1) { $this->performPublish($record); // BUGFIX: Changed icon sometimes shows after "Save & Publish" button is clicked http://support.silverstripe.com/gsoc/ticket/31 - if(substr($id,0,3) != 'new') { - $publishedRecord = DataObject::get_one($className, "`$className`.ID = $id"); - } else { - $publishedRecord = $this->getNewItem($id, false); - } + $record->setClassName( $record->ClassName ); + $newClass = $record->ClassName; + $publishedRecord = $record->newClassInstance( $newClass ); return $this->tellBrowserAboutPublicationChange($publishedRecord, "Published '$record->Title' successfully"); } else { // BUGFIX: Changed icon only shows after Save button is clicked twice http://support.silverstripe.com/gsoc/ticket/76