mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +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(
|
||||
<<<EOF
|
||||
// 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.SetFieldsCount($iFieldsCount);
|
||||
EOF
|
||||
|
||||
@@ -270,11 +270,21 @@ class WizardHelper
|
||||
{
|
||||
return $this->m_aData['m_sClass'];
|
||||
}
|
||||
|
||||
public function GetFormPrefix()
|
||||
{
|
||||
return $this->m_aData['m_sFormPrefix'];
|
||||
}
|
||||
|
||||
public function GetFormPrefix()
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -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' : '',
|
||||
'm_oFieldsMap': {},
|
||||
@@ -48,7 +48,17 @@ function WizardHelper(sClass, sFormPrefix, sState)
|
||||
'm_sState': sState
|
||||
};
|
||||
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
|
||||
this.SetFieldsMap = function (oFieldsMap)
|
||||
{
|
||||
|
||||
@@ -569,12 +569,17 @@ try
|
||||
$oObj->Set($sAttCode, $defaultValue);
|
||||
}
|
||||
$sFormPrefix = $oWizardHelper->GetFormPrefix();
|
||||
$aExpectedAttributes = $oObj->GetTransitionAttributes($oWizardHelper->GetStimulus(), $oWizardHelper->GetInitialState());
|
||||
foreach($oWizardHelper->GetFieldsForAllowedValues() as $sAttCode)
|
||||
{
|
||||
$sId = $oWizardHelper->GetIdForField($sAttCode);
|
||||
if ($sId != '')
|
||||
{
|
||||
if ($oObj->IsNew())
|
||||
if(array_key_exists($sAttCode, $aExpectedAttributes))
|
||||
{
|
||||
$iFlags = $aExpectedAttributes[$sAttCode];
|
||||
}
|
||||
elseif ($oObj->IsNew())
|
||||
{
|
||||
$iFlags = $oObj->GetInitialStateAttributeFlags($sAttCode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user