From b976f99054096266c78f8ef09928f01c39effe03 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Sun, 7 Oct 2007 22:13:50 +0000 Subject: [PATCH] Reapply r42087 git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@43181 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/LeftAndMain.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index fd600476..d8e0ae45 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -535,11 +535,9 @@ JS; if (isset($urlParams['publish']) && $urlParams['publish'] == 1) { $this->performPublish($record); - if(substr($SQL_id,0,3) != 'new') { - $publishedRecord = DataObject::get_one($className, "`$className`.ID = {$SQL_id}"); - } else { - $publishedRecord = $this->getNewItem($SQL_id, false); - } + $record->setClassName($record->ClassName); + $newClass = $record->ClassName; + $publishedRecord = $record->newClassInstance($newClass); return $this->tellBrowserAboutPublicationChange($publishedRecord, "Published '$record->Title' successfully"); } else { @@ -559,6 +557,7 @@ JS; */ public function getActionUpdateJS($record) { // Get the new action buttons + $tempForm = $this->getEditForm($record->ID); $actionList = ''; foreach($tempForm->Actions() as $action) {