N°6326 - Magnifier pop-up search from ExtKey in Link edit in pop-up, fails

This commit is contained in:
Benjamin Dalsass
2023-06-27 09:42:12 +02:00
parent d41e54bf34
commit f338d3bdc8
2 changed files with 27 additions and 2 deletions

View File

@@ -3049,16 +3049,21 @@ JS
$oPage->SetCurrentTab('');
// Static fields values for wizard helper serialization
$aWizardHelperStaticValues = [];
// Add as hidden inputs values that we want displayed if they're readonly
if(isset($aExtraParams['forceFieldsSubmission'])){
$aExtraFlags = $aExtraParams['fieldsFlags'] ?? [];
foreach ($aExtraParams['forceFieldsSubmission'] as $sAttCode) {
if(FormHelper::GetAttributeFlagsForObject($this, $sAttCode, $aExtraFlags) & OPT_ATT_READONLY) {
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('attr_'.$sPrefix.$sAttCode, $this->Get($sAttCode)));
$aWizardHelperStaticValues[$sAttCode] = $this->Get($sAttCode);
}
}
}
$sWizardHelperStaticValues = json_encode($aWizardHelperStaticValues);
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('class', $sClass));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('transaction_id', $iTransactionId));
foreach ($aExtraParams as $sName => $value) {
@@ -3101,6 +3106,7 @@ JS
var oWizardHelper$sPrefix = new WizardHelper('$sClass', '$sPrefix', '$sLifecycleStateForWizardHelper');
oWizardHelper$sPrefix.SetFieldsMap($sJsonFieldsMap);
oWizardHelper$sPrefix.SetFieldsCount($iFieldsCount);
oWizardHelper$sPrefix.SetStaticValues($sWizardHelperStaticValues);
EOF
);
$oPage->add_ready_script(

View File

@@ -65,6 +65,7 @@ function WizardHelper(sClass, sFormPrefix, sState, sInitialState, sStimulus) {
'm_aAllowedValuesRequested': [],
'm_oDefaultValue': {},
'm_oAllowedValues': {},
'm_aStaticValues' : {},
'm_iFieldsCount': 0,
'm_sFormPrefix': sFormPrefix,
'm_sState': sState,
@@ -113,6 +114,18 @@ function WizardHelper(sClass, sFormPrefix, sState, sInitialState, sStimulus) {
this.m_oData.m_oCurrentValues[sFieldName] = currentValue;
};
/**
* Set form object values for fields without field widget.
*
* @since 3.1
*
* @param values
* @constructor
*/
this.SetStaticValues = function(values){
this.m_oData.m_aStaticValues = values;
};
this.SetReturnNotEditableFields = function (bReturnNotEditableFields) {
this.m_oData.m_bReturnNotEditableFields = bReturnNotEditableFields;
};
@@ -223,9 +236,15 @@ function WizardHelper(sClass, sFormPrefix, sState, sInitialState, sStimulus) {
$('#wizStep'+G_iCurrentStep).unblock({fadeOut: 0});
});
};
this.UpdateCurrentValue = function (sFieldCode) {
var $oField = $('#'+this.m_oData.m_oFieldsMap[sFieldCode]);
// Static values handling
if(this.m_oData.m_aStaticValues.hasOwnProperty(sFieldCode)){
const value = this.m_oData.m_aStaticValues[sFieldCode];
this.m_oData.m_oCurrentValues[sFieldCode] = value;
return value;
}
$oField.trigger('update_value'); // Give the widget a chance to update its value (if it is aware of this event)
var value = $oField.val();
if (value == '')