Compare commits

...

6 Commits

Author SHA1 Message Date
Anne-Cath
88c19e6624 N°2364 - API : remove old linkedset persistance (#733) - deprecated message only on console and portal context. Avoid messages during tests, setup and other case 2025-10-02 11:34:57 +02:00
Anne-Cath
ea86325566 WIP 2025-10-02 11:34:57 +02:00
Anne-Cath
000748228f Fix test 2025-10-02 11:34:57 +02:00
Anne-Cath
a8ac86fca6 fix php doc 2025-10-02 11:34:57 +02:00
Anne-Catherine
f08350a72c Update application/cmdbabstract.class.inc.php
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@super-visions.com>
2025-10-02 11:34:57 +02:00
Anne-Cath
18f9f14dcd N°7577 - Issue with GetAttributeFlags when Attributes are set to HIDDEN 2025-10-02 11:34:56 +02:00
2 changed files with 33 additions and 2 deletions

View File

@@ -176,6 +176,10 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
*/
protected $sDisplayMode;
protected $aFieldsMap;
/**
* @var array Store posted values in order to be used in GetAttributeFlag
*/
protected $aPostedValues = [];
/**
* If true, bypass IsActionAllowedOnAttribute when writing this object
@@ -3884,7 +3888,33 @@ 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 GetAttributeFlag 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 GetAttributeFlag 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
*/
public function GetFormAttributeFlags($sAttCode)
@@ -4110,6 +4140,7 @@ HTML;
$aErrors = array();
$aFinalValues = array();
$this->aPostedValues = $aValues; // Store the values for later use (e.g. in getAttributeFlag)
foreach($this->GetWriteableAttList(array_keys($aValues), $aErrors, $aAttFlags) as $sAttCode => $oAttDef)
{
$aFinalValues[$sAttCode] = $aValues[$sAttCode];

View File

@@ -521,7 +521,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
* $oCISet->RemoveItem(123456);
* $oTicket->Set(functionalcis_list, $oCISet);
*/
if (!ContextTag::Check(ContextTag::TAG_SETUP)) {
if (ContextTag::Check(ContextTag::TAG_PORTAL) || ContextTag::Check(ContextTag::TAG_CONSOLE) ) {
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('old pattern - please get previous value of the linked set, modify it and set it back to the host object');
}
}