From 02dd08587cd7e7674f7e8fdda44dff59dd505050 Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Mon, 16 Aug 2010 14:49:36 +0000 Subject: [PATCH] #205 Notifications missing external fields (on object creation) SVN:trunk[676] --- core/dbobject.class.php | 5 +++-- core/metamodel.class.php | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/dbobject.class.php b/core/dbobject.class.php index d4b31bb4f..9f3a80b20 100644 --- a/core/dbobject.class.php +++ b/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; } diff --git a/core/metamodel.class.php b/core/metamodel.class.php index 1f893efd7..4bf3e7234 100644 --- a/core/metamodel.class.php +++ b/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); }