Jelajahi Sumber

#805 The label of the ticket must be computed at the last minute, just before insertion, for the Mutex to be effective

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2956 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 11 tahun lalu
induk
melakukan
d86340eb75

+ 2 - 8
datamodels/2.x/itop-change-mgmt-itil/datamodel.itop-change-mgmt-itil.xml

@@ -936,15 +936,9 @@
           <type>Overload-DBObject</type>
           <code><![CDATA[	public function ComputeValues()
 	{
-		$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('C-%06d', $iKey);
 			$this->Set('ref', $sName);
 		}

+ 2 - 8
datamodels/2.x/itop-change-mgmt/datamodel.itop-change-mgmt.xml

@@ -611,15 +611,9 @@
           <type>Overload-DBObject</type>
           <code><![CDATA[	public function ComputeValues()
 	{
-		$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('C-%06d', $iKey);
 			$this->Set('ref', $sName);
 		}

+ 2 - 8
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);
 		}

+ 2 - 8
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);
 		}

+ 3 - 8
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);
 		}

+ 2 - 8
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);
 		}