Form prefill: add possibility to change attributes flag on the fly

SVN:trunk[6000]
This commit is contained in:
Stephen Abello
2018-08-06 14:33:47 +00:00
parent 6e6a89fb8c
commit 7d37b06555
2 changed files with 8 additions and 3 deletions

View File

@@ -2380,7 +2380,7 @@ EOF
return $oObj->DisplayModifyForm( $oPage, $aExtraParams);
}
public function DisplayStimulusForm(WebPage $oPage, $sStimulus)
public function DisplayStimulusForm(WebPage $oPage, $sStimulus, $aPrefillFormParam = null)
{
$sClass = get_class($this);
$iKey = $this->GetKey();
@@ -2422,6 +2422,12 @@ EOF
$oPage->add("<h1>$sActionDetails</h1>\n");
$sTargetState = $aTransitions[$sStimulus]['target_state'];
$aExpectedAttributes = $this->GetTransitionAttributes($sStimulus /*, current state*/);
if ($aPrefillFormParam != null)
{
$aPrefillFormParam['expected_attributes'] = $aExpectedAttributes;
$this->PrefillForm('state_change', $aPrefillFormParam);
$aExpectedAttributes = $aPrefillFormParam['expected_attributes'];
}
$sButtonsPosition = MetaModel::GetConfig()->Get('buttons_position');
if ($sButtonsPosition == 'bottom')
{

View File

@@ -1485,8 +1485,7 @@ EOF
'stimulus' => $sStimulus,
'origin' => 'console'
);
$oObj->PrefillForm('state_change', $aPrefillFormParam);
$oObj->DisplayStimulusForm($oP, $sStimulus);
$oObj->DisplayStimulusForm($oP, $sStimulus, $aPrefillFormParam);
}
else
{