mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-21 00:02:17 +02:00
1627 - Ticket ref sometimes duplicate
This code is a drop in replacement based on an abstract counter based on an abstract keyValue store. The counter can be - class based (in this case the counter is initialized on max(id) + 1 - key based (in this case the counter starts at 0) Important: on both cases the counter is no more kept aligned with the primary key. This lead to a MySQL8 compatible implementation.
This commit is contained in:
committed by
OИUЯd da silva
parent
c6f5b8b1f9
commit
57116ef054
@@ -203,12 +203,10 @@
|
||||
public function DBInsertNoReload()
|
||||
{
|
||||
$oMutex = new iTopMutex('ticket_insert');
|
||||
$oMutex->Lock();
|
||||
$iNextId = MetaModel::GetNextKey(get_class($this));
|
||||
$iNextId = ItopCounter::IncClass(get_class($this));
|
||||
$sRef = $this->MakeTicketRef($iNextId);
|
||||
$this->SetIfNull('ref', $sRef);
|
||||
$iKey = parent::DBInsertNoReload();
|
||||
$oMutex->Unlock();
|
||||
return $iKey;
|
||||
}
|
||||
]]></code>
|
||||
|
||||
Reference in New Issue
Block a user