N°1476 : Fixed a regression introduced in 2.5 where on changing final class on a n-n object selection form, checkboxes were lost.

SVN:trunk[5830]
This commit is contained in:
Stephen Abello
2018-06-07 07:41:49 +00:00
parent 2706ebf638
commit 5bad1e1c88
3 changed files with 42 additions and 12 deletions

View File

@@ -250,7 +250,7 @@ function UpdateFileName(id, sNewFileName) {
/**
* Reload a search form for the specified class
*/
function ReloadSearchForm(divId, sClassName, sBaseClass, sContext, sTableId) {
function ReloadSearchForm(divId, sClassName, sBaseClass, sContext, sTableId, sExtraParams) {
var oDiv = $('#ds_'+divId);
oDiv.block();
// deprecated in jQuery 1.8
@@ -278,7 +278,23 @@ function ReloadSearchForm(divId, sClassName, sBaseClass, sContext, sTableId) {
oMap.currentId = divId;
oMap._table_id_ = sTableId;
oMap.action = sAction;
if(sExtraParams['selection_mode'])
{
oMap.selection_mode = sExtraParams['selection_mode'];
}
if(sExtraParams['result_list_outer_selector'])
{
oMap.result_list_outer_selector = sExtraParams['result_list_outer_selector'];
}
if(sExtraParams['cssCount'])
{
oMap.css_count = sExtraParams['cssCount'];
$(sExtraParams['cssCount']).val(0).trigger('change');
}
if(sExtraParams['table_inner_id'])
{
oMap.table_inner_id = sExtraParams['table_inner_id'];
}
$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php?'+sContext, oMap,
function (data) {
oDiv.empty();

View File

@@ -861,9 +861,21 @@ try
$currentId = utils::ReadParam('currentId', '');
$sTableId = utils::ReadParam('_table_id_', null, false, 'raw_data');
$sAction = utils::ReadParam('action', '');
$sSelectionMode = utils::ReadParam('selection_mode', null,false,'raw_data');
$sResultListOuterSelector = utils::ReadParam('result_list_outer_selector', null,false,'raw_data');
$scssCount = utils::ReadParam('css_count', null,false,'raw_data');
$sTableInnerId = utils::ReadParam('table_inner_id', null,false,'raw_data');
$oFilter = new DBObjectSearch($sClass);
$oSet = new CMDBObjectSet($oFilter);
$sHtml = cmdbAbstractObject::GetSearchForm($oPage, $oSet, array('currentId' => $currentId, 'baseClass' => $sRootClass, 'action' => $sAction, 'table_id' => $sTableId));
$sHtml = cmdbAbstractObject::GetSearchForm($oPage, $oSet, array('currentId' => $currentId,
'baseClass' => $sRootClass,
'action' => $sAction,
'table_id' => $sTableId,
'selection_mode' => $sSelectionMode,
'result_list_outer_selector' => $sResultListOuterSelector,
'cssCount' => $scssCount,
'table_inner_id' => $sTableInnerId));
$oPage->add($sHtml);
break;

View File

@@ -135,7 +135,8 @@ class SearchForm
$aOptions[MetaModel::GetName($sClassName)] = "<option selected value=\"$sClassName\">".MetaModel::GetName($sClassName)."</options>\n";
ksort($aOptions);
$sContext = $oAppContext->GetForLink();
$sClassesCombo = "<select name=\"class\" onChange=\"ReloadSearchForm('$sSearchFormId', this.value, '$sRootClass', '$sContext', '{$aExtraParams['result_list_outer_selector']}')\">\n".implode('',
$sJsonExtraParams = htmlentities(json_encode($aListParams), ENT_QUOTES);
$sClassesCombo = "<select name=\"class\" onChange=\"ReloadSearchForm('$sSearchFormId', this.value, '$sRootClass', '$sContext', '{$aExtraParams['result_list_outer_selector']}', $sJsonExtraParams)\">\n".implode('',
$aOptions)."</select>\n";
}
else
@@ -218,19 +219,20 @@ class SearchForm
}
$sBaseOQL = str_replace(' WHERE 1', '', $oBaseSearch->ToOQL());
if (isset($aExtraParams['table_inner_id']))
{
$sDataConfigListSelector = $aExtraParams['table_inner_id'];
}
else
{
$sDataConfigListSelector = $aExtraParams['result_list_outer_selector'];
}
if (!isset($aExtraParams['table_inner_id']))
{
$aListParams['table_inner_id'] = "table_inner_id_{$sSearchFormId}";
}
if (isset($aExtraParams['result_list_outer_selector']))
{
$sDataConfigListSelector = $aExtraParams['result_list_outer_selector'];
}
else
{
$sDataConfigListSelector = $aExtraParams['table_inner_id'];
}
$sDebug = utils::ReadParam('debug', 'false', false, 'parameter');
if ($sDebug == 'true')
{