N°2293 Object update hooks now have access to object changes

* new \cmdbAbstractObject::$m_aChanges for \iApplicationObjectExtension::OnDBUpdate calls
* calling ListChanges() from within \DBObject::AfterUpdate will now give the right informations
* update PHPDoc in iApplicationObjectExtension
This commit is contained in:
Pierre Goiffon
2019-08-23 10:12:36 +02:00
parent 58402cdda8
commit c97fd63e6d
3 changed files with 31 additions and 20 deletions

View File

@@ -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;
}