mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°653: Dependant fields on transitions was not using transition flags.
SVN:trunk[4769]
This commit is contained in:
@@ -2628,7 +2628,7 @@ EOF
|
|||||||
$oPage->add_script(
|
$oPage->add_script(
|
||||||
<<<EOF
|
<<<EOF
|
||||||
// Initializes the object once at the beginning of the page...
|
// Initializes the object once at the beginning of the page...
|
||||||
var oWizardHelper = new WizardHelper('$sClass', '', '$sTargetState');
|
var oWizardHelper = new WizardHelper('$sClass', '', '$sTargetState', '{$this->GetState()}', '$sStimulus');
|
||||||
oWizardHelper.SetFieldsMap($sJsonFieldsMap);
|
oWizardHelper.SetFieldsMap($sJsonFieldsMap);
|
||||||
oWizardHelper.SetFieldsCount($iFieldsCount);
|
oWizardHelper.SetFieldsCount($iFieldsCount);
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
@@ -270,11 +270,21 @@ class WizardHelper
|
|||||||
{
|
{
|
||||||
return $this->m_aData['m_sClass'];
|
return $this->m_aData['m_sClass'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetFormPrefix()
|
public function GetFormPrefix()
|
||||||
{
|
{
|
||||||
return $this->m_aData['m_sFormPrefix'];
|
return $this->m_aData['m_sFormPrefix'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function GetInitialState()
|
||||||
|
{
|
||||||
|
return $this->m_aData['m_sInitialState'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function GetStimulus()
|
||||||
|
{
|
||||||
|
return $this->m_aData['m_sStimulus'];
|
||||||
|
}
|
||||||
|
|
||||||
public function GetIdForField($sFieldName)
|
public function GetIdForField($sFieldName)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ if (!Array.prototype.indexOf) // Emulation of the indexOf function for IE and ol
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function WizardHelper(sClass, sFormPrefix, sState)
|
function WizardHelper(sClass, sFormPrefix, sState, sInitialState, sStimulus)
|
||||||
{
|
{
|
||||||
this.m_oData = { 'm_sClass' : '',
|
this.m_oData = { 'm_sClass' : '',
|
||||||
'm_oFieldsMap': {},
|
'm_oFieldsMap': {},
|
||||||
@@ -48,7 +48,17 @@ function WizardHelper(sClass, sFormPrefix, sState)
|
|||||||
'm_sState': sState
|
'm_sState': sState
|
||||||
};
|
};
|
||||||
this.m_oData.m_sClass = sClass;
|
this.m_oData.m_sClass = sClass;
|
||||||
|
|
||||||
|
// Setting optional transition data
|
||||||
|
if(sInitialState !== undefined)
|
||||||
|
{
|
||||||
|
this.m_oData.m_sInitialState = sInitialState;
|
||||||
|
}
|
||||||
|
if(sStimulus !== undefined)
|
||||||
|
{
|
||||||
|
this.m_oData.m_sStimulus = sStimulus;
|
||||||
|
}
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
this.SetFieldsMap = function (oFieldsMap)
|
this.SetFieldsMap = function (oFieldsMap)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -569,12 +569,17 @@ try
|
|||||||
$oObj->Set($sAttCode, $defaultValue);
|
$oObj->Set($sAttCode, $defaultValue);
|
||||||
}
|
}
|
||||||
$sFormPrefix = $oWizardHelper->GetFormPrefix();
|
$sFormPrefix = $oWizardHelper->GetFormPrefix();
|
||||||
|
$aExpectedAttributes = $oObj->GetTransitionAttributes($oWizardHelper->GetStimulus(), $oWizardHelper->GetInitialState());
|
||||||
foreach($oWizardHelper->GetFieldsForAllowedValues() as $sAttCode)
|
foreach($oWizardHelper->GetFieldsForAllowedValues() as $sAttCode)
|
||||||
{
|
{
|
||||||
$sId = $oWizardHelper->GetIdForField($sAttCode);
|
$sId = $oWizardHelper->GetIdForField($sAttCode);
|
||||||
if ($sId != '')
|
if ($sId != '')
|
||||||
{
|
{
|
||||||
if ($oObj->IsNew())
|
if(array_key_exists($sAttCode, $aExpectedAttributes))
|
||||||
|
{
|
||||||
|
$iFlags = $aExpectedAttributes[$sAttCode];
|
||||||
|
}
|
||||||
|
elseif ($oObj->IsNew())
|
||||||
{
|
{
|
||||||
$iFlags = $oObj->GetInitialStateAttributeFlags($sAttCode);
|
$iFlags = $oObj->GetInitialStateAttributeFlags($sAttCode);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user