mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
Compare commits
6 Commits
develop
...
feature/75
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6efe0f5dac | ||
|
|
ef720cf0be | ||
|
|
f90d10114d | ||
|
|
da0066dd14 | ||
|
|
3f68e161be | ||
|
|
cc8c3d3bf1 |
@@ -175,6 +175,10 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
|
||||
*/
|
||||
protected $sDisplayMode;
|
||||
protected $aFieldsMap;
|
||||
/**
|
||||
* @var array Store posted values in order to be used in GetAttributeFlags
|
||||
*/
|
||||
protected $aPostedValues = [];
|
||||
|
||||
/**
|
||||
* If true, bypass IsActionAllowedOnAttribute when writing this object
|
||||
@@ -3794,6 +3798,32 @@ HTML;
|
||||
return $aWriteableAttList;
|
||||
}
|
||||
|
||||
/**
|
||||
* function to test if the posted value or if not exists the existing value matches the expected value
|
||||
* this is used to check the current value in GetAttributeFlags function (useful to manage dynamic readonly attributes)
|
||||
* @param $sAttCode
|
||||
*/
|
||||
public function GetCurrentValueInScreen($sAttCode)
|
||||
{
|
||||
if (array_key_exists($sAttCode, $this->aPostedValues)) {
|
||||
return $this->aPostedValues[$sAttCode];
|
||||
}
|
||||
return $this->Get($sAttCode);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function checks if the value of the attribute has been modified in screen
|
||||
* this is used to check if field has been modified in GetAttributeFlags function (useful to manage dynamic readonly attributes)
|
||||
* @param $sAttCode
|
||||
*/
|
||||
public function IsModifiedValueInScreen($sAttCode)
|
||||
{
|
||||
if (array_key_exists($sAttCode, $this->aPostedValues)) {
|
||||
return $this->aPostedValues[$sAttCode] != $this->Get($sAttCode);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the attribute flags depending on the object state
|
||||
*/
|
||||
@@ -3986,6 +4016,7 @@ HTML;
|
||||
|
||||
$aErrors = [];
|
||||
$aFinalValues = [];
|
||||
$this->aPostedValues = $aValues; // Store the values for later use (e.g. in GetAttributeFlags)
|
||||
foreach ($this->GetWriteableAttList(array_keys($aValues), $aErrors, $aAttFlags) as $sAttCode => $oAttDef) {
|
||||
$aFinalValues[$sAttCode] = $aValues[$sAttCode];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user