-
Notifications
You must be signed in to change notification settings - Fork 284
N°7289 - Read-only attribute, dynamically read-write, entry silently ignored on submission #724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
18f9f14
f08350a
a8ac86f
0007482
ea86325
88c19e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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 @@ public function GetWriteableAttList($aAttList, &$aErrors, $aAttFlags = array()) | |||||
| 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 | ||||||
|
Comment on lines
+3891
to
+3894
|
||||||
| */ | ||||||
| public function GetCurrentValueInScreen($sAttCode) | ||||||
| { | ||||||
|
Comment on lines
+3896
to
+3897
|
||||||
| 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 | ||||||
|
Comment on lines
+3905
to
+3907
|
||||||
| */ | ||||||
| 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 @@ public function UpdateObjectFromPostedForm($sFormPrefix = '', $aAttList = null, | |||||
|
|
||||||
| $aErrors = array(); | ||||||
| $aFinalValues = array(); | ||||||
| $this->aPostedValues = $aValues; // Store the values for later use (e.g. in getAttributeFlag) | ||||||
|
||||||
| $this->aPostedValues = $aValues; // Store the values for later use (e.g. in getAttributeFlag) | |
| $this->aPostedValues = $aValues; // Store the values for later use (e.g. in GetAttributeFlags()) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -521,7 +521,7 @@ public function UpdateFromCompleteList(iDBObjectSetIterator $oFellow) | |
| * $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'); | ||
|
Comment on lines
+524
to
525
|
||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation of this new property/docblock doesn’t follow the surrounding convention in this file (tabs). Also the doc refers to “GetAttributeFlag” but the actual API is
GetAttributeFlags()/GetFormAttributeFlags(); please update the wording to avoid confusion.