Compare commits

...

6 Commits

Author SHA1 Message Date
Anne-Cath
6efe0f5dac fix comment 2026-04-20 10:36:37 +02:00
Anne-Cath
ef720cf0be WIP 2026-04-20 10:19:09 +02:00
Anne-Cath
f90d10114d Fix test 2026-04-20 10:19:09 +02:00
Anne-Cath
da0066dd14 fix php doc 2026-04-20 10:19:08 +02:00
Anne-Catherine
3f68e161be Update application/cmdbabstract.class.inc.php
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@super-visions.com>
2026-04-20 10:19:08 +02:00
Anne-Cath
cc8c3d3bf1 N°7577 - Issue with GetAttributeFlags when Attributes are set to HIDDEN 2026-04-20 10:19:05 +02:00

View File

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