diff --git a/application/applicationextension.inc.php b/application/applicationextension.inc.php
index 80e5e28cd..6be9c58d8 100644
--- a/application/applicationextension.inc.php
+++ b/application/applicationextension.inc.php
@@ -344,15 +344,16 @@ interface iApplicationUIExtension
interface iApplicationObjectExtension
{
/**
- * Invoked to determine wether an object has been modified in memory
+ * Invoked to determine whether an object has been modified in memory
*
* The GUI calls this verb to determine the message that will be displayed to the end-user.
* Anyhow, this API can be called in other contexts such as the CSV import tool.
*
* If the extension returns false, then the framework will perform the usual evaluation.
* Otherwise, the answer is definitively "yes, the object has changed".
- *
- * @param DBObject $oObject The target object
+ *
+ * @param \cmdbAbstractObject $oObject The target object
+ *
* @return boolean True if something has changed for the target object
*/
public function OnIsModified($oObject);
@@ -362,8 +363,9 @@ interface iApplicationObjectExtension
*
* The GUI calls this verb and reports any issue.
* Anyhow, this API can be called in other contexts such as the CSV import tool.
- *
- * @param DBObject $oObject The target object
+ *
+ * @param \cmdbAbstractObject $oObject The target object
+ *
* @return string[] A list of errors message. An error message is made of one line and it can be displayed to the end-user.
*/
public function OnCheckToWrite($oObject);
@@ -372,21 +374,23 @@ interface iApplicationObjectExtension
* Invoked to determine wether an object can be deleted from the database
*
* The GUI calls this verb and stops the deletion process if any issue is reported.
- *
- * Please not that it is not possible to cascade deletion by this mean: only stopper issues can be handled.
- *
- * @param DBObject $oObject The target object
+ *
+ * Please not that it is not possible to cascade deletion by this mean: only stopper issues can be handled.
+ *
+ * @param \cmdbAbstractObject $oObject The target object
+ *
* @return string[] A list of errors message. An error message is made of one line and it can be displayed to the end-user.
*/
public function OnCheckToDelete($oObject);
/**
- * Invoked when an object is updated into the database
- *
- * The method is called right after the object has been written to the database.
- *
- * @param DBObject $oObject The target object
+ * Invoked when an object is updated into the database. The method is called right after the object has been written to the database.
+ *
+ * Changes made to the object can be get using {@link \cmdbAbstractObject::$m_aChanges}
+ *
+ * @param \cmdbAbstractObject $oObject The target object
* @param CMDBChange|null $oChange A change context. Since 2.0 it is fine to ignore it, as the framework does maintain this information once for all the changes made within the current page
+ *
* @return void
*/
public function OnDBUpdate($oObject, $oChange = null);
@@ -395,9 +399,10 @@ interface iApplicationObjectExtension
* Invoked when an object is created into the database
*
* The method is called right after the object has been written to the database.
- *
- * @param DBObject $oObject The target object
+ *
+ * @param \cmdbAbstractObject $oObject The target object
* @param CMDBChange|null $oChange A change context. Since 2.0 it is fine to ignore it, as the framework does maintain this information once for all the changes made within the current page
+ *
* @return void
*/
public function OnDBInsert($oObject, $oChange = null);
diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php
index a283575ed..af0e503c3 100644
--- a/application/cmdbabstract.class.inc.php
+++ b/application/cmdbabstract.class.inc.php
@@ -54,8 +54,10 @@ require_once(APPROOT.'sources/application/search/criterionconversion/criterionto
abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
{
protected $m_iFormId; // The ID of the form used to edit the object (when in edition mode !)
- static $iGlobalFormId = 1;
+ protected static $iGlobalFormId = 1;
protected $aFieldsMap;
+ /** @var array attname => currentvalue Persists changes for {@link DBUpdate} */
+ protected $m_aChanges;
/**
* If true, bypass IsActionAllowedOnAttribute when writing this object
@@ -3731,6 +3733,8 @@ EOF
public function DBUpdate()
{
+ $this->m_aChanges = $this->ListChanges();
+
$res = parent::DBUpdate();
$this->SetWarningsAsSessionMessages('update');
@@ -3763,6 +3767,8 @@ EOF
unset($aUpdateReentrance[$sKey]);
}
+ $this->m_aChanges = array();
+
return $res;
}
diff --git a/core/dbobject.class.php b/core/dbobject.class.php
index 5b617494c..9bf0e7b6e 100644
--- a/core/dbobject.class.php
+++ b/core/dbobject.class.php
@@ -3148,12 +3148,12 @@ abstract class DBObject implements iDisplay
$this->DBWriteLinks();
$this->WriteExternalAttributes();
+ $this->AfterUpdate();
+
$this->m_bDirty = false;
$this->m_aTouchedAtt = array();
$this->m_aModifiedAtt = array();
- $this->AfterUpdate();
-
// Reload to get the external attributes
if ($bHasANewExternalKeyValue)
{
@@ -3969,7 +3969,7 @@ abstract class DBObject implements iDisplay
}
/**
- * this method is called after the object is updated into DB.
+ * This method is called after the object is updated into DB. You can get changes by calling {@link ListChanges}.
*
* @overwritable-hook You can extend this method in order to provide your own logic.
*/