iTop
iTop copied to clipboard
N°7289 - Read-only attribute, dynamically read-write, entry silently ignored on submission
use this delta with GetCurrentValue in place of Get and Vincent's example (in bug 7289) will work :
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.1">
<classes>
<class id="Location" _created_in="itop-structure" _delta="must_exist">
<fields>
<field id="person_id" xsi:type="AttributeExternalKey" _delta="define">
<sql>person_id</sql>
<filter/>
<dependencies>
<attribute id="status"/>
</dependencies>
<is_null_allowed>true</is_null_allowed>
<target_class>Person</target_class>
<on_target_delete>DEL_AUTO</on_target_delete>
<tracking_level>all</tracking_level>
</field>
</fields>
<methods>
<method id="GetAttributeFlags" _delta="define">
<comment></comment>
<static>false</static>
<access>public</access>
<code><![CDATA[public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '')
{
if (($sAttCode == 'person_id') && ($this->GetCurrentValue('status') == 'inactive'))
{
// Combine the new Flag with those impose by a parent class
return(OPT_ATT_READONLY | parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState));
}
return parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState);
}]]></code>
</method>
</methods>
<presentation>
<details >
<items>
<item id="person_id" _delta="define">
<rank>100</rank>
</item>
</items>
</details>
</presentation>
</class>
</classes>
<dictionaries>
</dictionaries>
<files>
</files>
<branding>
</branding>
</itop_design>