diff --git a/datamodels/2.x/itop-change-mgmt-itil/datamodel.itop-change-mgmt-itil.xml b/datamodels/2.x/itop-change-mgmt-itil/datamodel.itop-change-mgmt-itil.xml
index ab87fbb4e3..aadb4e190e 100755
--- a/datamodels/2.x/itop-change-mgmt-itil/datamodel.itop-change-mgmt-itil.xml
+++ b/datamodels/2.x/itop-change-mgmt-itil/datamodel.itop-change-mgmt-itil.xml
@@ -936,15 +936,9 @@
Overload-DBObject
Get('ref');
- if (strlen($sCurrRef) == 0)
+ if ($this->IsNew())
{
- $iKey = $this->GetKey();
- if ($iKey < 0)
- {
- // Object not yet in the Database
- $iKey = MetaModel::GetNextKey(get_class($this));
- }
+ $iKey = MetaModel::GetNextKey(get_class($this));
$sName = sprintf('C-%06d', $iKey);
$this->Set('ref', $sName);
}
diff --git a/datamodels/2.x/itop-change-mgmt/datamodel.itop-change-mgmt.xml b/datamodels/2.x/itop-change-mgmt/datamodel.itop-change-mgmt.xml
index be1ef67d6d..c0488c04c6 100755
--- a/datamodels/2.x/itop-change-mgmt/datamodel.itop-change-mgmt.xml
+++ b/datamodels/2.x/itop-change-mgmt/datamodel.itop-change-mgmt.xml
@@ -611,15 +611,9 @@
Overload-DBObject
Get('ref');
- if (strlen($sCurrRef) == 0)
+ if ($this->IsNew())
{
- $iKey = $this->GetKey();
- if ($iKey < 0)
- {
- // Object not yet in the Database
- $iKey = MetaModel::GetNextKey(get_class($this));
- }
+ $iKey = MetaModel::GetNextKey(get_class($this));
$sName = sprintf('C-%06d', $iKey);
$this->Set('ref', $sName);
}
diff --git a/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml b/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml
index 4bd87b9d15..7aa5ff2639 100755
--- a/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml
+++ b/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml
@@ -1264,15 +1264,9 @@
// Compute the priority of the ticket
$this->Set('priority', $this->ComputePriority());
- $sCurrRef = $this->Get('ref');
- if (strlen($sCurrRef) == 0)
+ if ($this->IsNew())
{
- $iKey = $this->GetKey();
- if ($iKey < 0)
- {
- // Object not yet in the Database
- $iKey = MetaModel::GetNextKey(get_class($this));
- }
+ $iKey = MetaModel::GetNextKey(get_class($this));
$sName = sprintf('I-%06d', $iKey);
$this->Set('ref', $sName);
}
diff --git a/datamodels/2.x/itop-problem-mgmt/datamodel.itop-problem-mgmt.xml b/datamodels/2.x/itop-problem-mgmt/datamodel.itop-problem-mgmt.xml
index 56b2154abf..7aba666eb6 100755
--- a/datamodels/2.x/itop-problem-mgmt/datamodel.itop-problem-mgmt.xml
+++ b/datamodels/2.x/itop-problem-mgmt/datamodel.itop-problem-mgmt.xml
@@ -503,15 +503,9 @@
// Compute the priority of the ticket
$this->Set('priority', $this->ComputePriority());
- $sCurrRef = $this->Get('ref');
- if (strlen($sCurrRef) == 0)
+ if ($this->IsNew())
{
- $iKey = $this->GetKey();
- if ($iKey < 0)
- {
- // Object not yet in the Database
- $iKey = MetaModel::GetNextKey(get_class($this));
- }
+ $iKey = MetaModel::GetNextKey(get_class($this));
$sName = sprintf('P-%06d', $iKey);
$this->Set('ref', $sName);
}
diff --git a/datamodels/2.x/itop-request-mgmt-itil/datamodel.itop-request-mgmt-itil.xml b/datamodels/2.x/itop-request-mgmt-itil/datamodel.itop-request-mgmt-itil.xml
index f270b1e0fd..823898159b 100755
--- a/datamodels/2.x/itop-request-mgmt-itil/datamodel.itop-request-mgmt-itil.xml
+++ b/datamodels/2.x/itop-request-mgmt-itil/datamodel.itop-request-mgmt-itil.xml
@@ -1670,15 +1670,10 @@
// Compute the priority of the ticket
$this->Set('priority', $this->ComputePriority());
- $sCurrRef = $this->Get('ref');
- if (strlen($sCurrRef) == 0)
+ if ($this->IsNew())
{
- $iKey = $this->GetKey();
- if ($iKey < 0)
- {
- // Object not yet in the Database
- $iKey = MetaModel::GetNextKey(get_class($this));
- }
+ // Object not yet in the Database
+ $iKey = MetaModel::GetNextKey(get_class($this));
$sName = sprintf('R-%06d', $iKey);
$this->Set('ref', $sName);
}
diff --git a/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml b/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml
index 7b1331411c..d7a3115acb 100755
--- a/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml
+++ b/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml
@@ -1657,15 +1657,9 @@
// Compute the priority of the ticket
$this->Set('priority', $this->ComputePriority());
- $sCurrRef = $this->Get('ref');
- if (strlen($sCurrRef) == 0)
+ if ($this->IsNew())
{
- $iKey = $this->GetKey();
- if ($iKey < 0)
- {
- // Object not yet in the Database
- $iKey = MetaModel::GetNextKey(get_class($this));
- }
+ $iKey = MetaModel::GetNextKey(get_class($this));
$sName = sprintf('R-%06d', $iKey);
$this->Set('ref', $sName);
}