diff --git a/core/dbobject.class.php b/core/dbobject.class.php index 907e5485c..17a794e92 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -2971,11 +2971,6 @@ abstract class DBObject implements iDisplay $this->DoComputeValues(); $this->OnInsert(); - if ($this->m_iKey < 0) { - // This was a temporary "memory" key: discard it so that DBInsertSingleTable will not try to use it! - $this->m_iKey = null; - } - // If not automatically computed, then check that the key is given by the caller if (!MetaModel::IsAutoIncrementKey($sRootClass)) { if (empty($this->m_iKey)) { @@ -2987,6 +2982,12 @@ abstract class DBObject implements iDisplay if (!$bRes) { throw new CoreCannotSaveObjectException(array('issues' => $aIssues, 'class' => get_class($this), 'id' => $this->GetKey())); } + + if ($this->m_iKey < 0) { + // This was a temporary "memory" key: discard it so that DBInsertSingleTable will not try to use it! + $this->m_iKey = null; + } + $this->ComputeStopWatchesDeadline(true); $iTransactionRetry = 1; diff --git a/sources/Controller/Base/Layout/ObjectController.php b/sources/Controller/Base/Layout/ObjectController.php index c8987fa9e..07ea291ec 100644 --- a/sources/Controller/Base/Layout/ObjectController.php +++ b/sources/Controller/Base/Layout/ObjectController.php @@ -278,11 +278,6 @@ JS; $aResult['data'] = ['error_message' => $e->getHtmlMessage()]; } else { $sClassLabel = MetaModel::GetName($sClass); - $sClassIcon = MetaModel::GetClassIcon($sClass); - $sHeaderTitle = Dict::Format('UI:CreationTitle_Class', $sClassLabel); - - // Important: This is a temporary fix for N°5951, we need to discuss the DBObject::DBInsertNoReload() sequence before going further - $oObj->SetKey(-1); $oPage->set_title(Dict::Format('UI:CreationPageTitle_Class', $sClassLabel)); if (!empty($aIssues)) {