mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°5951 - Fix crash when creating a user with a non valid password
/!\ Mind that this could have impact on DoCheckToWrite() overloads for people using \DBObject::GetKey() instead of \DBObject::IsNew()
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user