Explorar o código

#205 Notifications missing external fields (on object creation)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@676 a333f486-631f-4898-b8df-5754b55c2be0
romainq %!s(int64=15) %!d(string=hai) anos
pai
achega
b992ec51e3
Modificáronse 2 ficheiros con 8 adicións e 4 borrados
  1. 3 2
      core/dbobject.class.php
  2. 5 2
      core/metamodel.class.php

+ 3 - 2
core/dbobject.class.php

@@ -39,7 +39,8 @@ abstract class DBObject
 	private $m_aCurrValues = array();
 	protected $m_aOrigValues = array();
 
-	private $m_bDirty = false; // The object may have incorrect external keys, then any attempt of reload must be avoided
+	private $m_bDirty = false; // Means: "a modification is ongoing"
+										// The object may have incorrect external keys, then any attempt of reload must be avoided
 	private $m_bFullyLoaded = false; // Compound objects can be partially loaded
 	private $m_aLoadedAtt = array(); // Compound objects can be partially loaded, array of sAttCode
 
@@ -884,6 +885,7 @@ abstract class DBObject
 
 		$this->DBWriteLinks();
 		$this->m_bIsInDB = true;
+		$this->m_bDirty = false;
 
 		// Activate any existing trigger 
 		$sClass = get_class($this);
@@ -902,7 +904,6 @@ abstract class DBObject
 	public function DBInsert()
 	{
 		$this->DBInsertNoReload();
-		$this->m_bDirty = false;
 		$this->Reload();
 		return $this->m_iKey;
 	}

+ 5 - 2
core/metamodel.class.php

@@ -3476,10 +3476,13 @@ abstract class MetaModel
 	{
 		$aSearches = array();
 		$aReplacements = array();
-		foreach($aParams as $sSearch => $sReplace)
+		foreach($aParams as $sSearch => $replace)
 		{
+			// Some environment parameters are objects, we just need scalars
+			if (is_object($replace)) continue;
+
 			$aSearches[] = '$'.$sSearch.'$';
-			$aReplacements[] = $sReplace;
+			$aReplacements[] = (string) $replace;
 		}
 		return str_replace($aSearches, $aReplacements, $aInput);
 	}