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 43f4e3216..8dce8e87a 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
@@ -932,20 +932,6 @@
$this->Set('last_update', time());
}]]>
-
- false
- public
- Overload-DBObject
- IsNew())
- {
- $iKey = MetaModel::GetNextKey(get_class($this));
- $sName = sprintf('C-%06d', $iKey);
- $this->Set('ref', $sName);
- }
- }]]>
-
/**
* Get the icon representing this object
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 96359117f..b03fe7b33 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
@@ -633,20 +633,6 @@
$this->Set('last_update', time());
}]]>
-
- false
- public
- Overload-DBObject
- IsNew())
- {
- $iKey = MetaModel::GetNextKey(get_class($this));
- $sName = sprintf('C-%06d', $iKey);
- $this->Set('ref', $sName);
- }
- }]]>
-
/**
* Get the icon representing this object
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 ce606df4d..dcc6bcc0a 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
@@ -1277,13 +1277,6 @@
// Compute the priority of the ticket
$this->Set('priority', $this->ComputePriority());
- if ($this->IsNew())
- {
- $iKey = MetaModel::GetNextKey(get_class($this));
- $sName = sprintf('I-%06d', $iKey);
- $this->Set('ref', $sName);
- }
-
return parent::ComputeValues();
}]]>
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 4495e4cf8..864701630 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
@@ -504,13 +504,6 @@
{
// Compute the priority of the ticket
$this->Set('priority', $this->ComputePriority());
-
- if ($this->IsNew())
- {
- $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 013b1ddad..9cd2d0f49 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
@@ -1667,14 +1667,6 @@
// Compute the priority of the ticket
$this->Set('priority', $this->ComputePriority());
- if ($this->IsNew())
- {
- // Object not yet in the Database
- $iKey = MetaModel::GetNextKey(get_class($this));
- $sName = sprintf('R-%06d', $iKey);
- $this->Set('ref', $sName);
- }
-
return parent::ComputeValues();
}]]>
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 2400fc191..3d0d2456b 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
@@ -1653,13 +1653,6 @@
// Compute the priority of the ticket
$this->Set('priority', $this->ComputePriority());
- if ($this->IsNew())
- {
- $iKey = MetaModel::GetNextKey(get_class($this));
- $sName = sprintf('R-%06d', $iKey);
- $this->Set('ref', $sName);
- }
-
return parent::ComputeValues();
}]]>
diff --git a/datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml b/datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml
index 5c31d9c04..c87fb38f9 100755
--- a/datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml
+++ b/datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml
@@ -48,7 +48,7 @@
ref
- false
+ true
org_id
@@ -164,37 +164,53 @@
false
public
Overload-DBObject
- Lock();
- $iKey = parent::DBInsertNoReload();
- $oMutex->Unlock();
- return $iKey;
+ $oMutex = new iTopMutex('ticket_insert');
+ $oMutex->Lock();
+ $iNextId = MetaModel::GetNextKey(get_class($this));
+ $sRef = $this->MakeTicketRef($iNextId);
+ $this->Set('ref', $sRef);
+ $iKey = parent::DBInsertNoReload();
+ $oMutex->Unlock();
+ return $iKey;
}
]]>
-
+
false
protected
Overload-DBObject
- Lock();
- }
- $ret = parent::DBInsertTracked_Internal($bDoNotReload);
- if ($bDoNotReload)
- {
- $oMutex->Unlock();
- }
- return $ret;
- }
+