N°3868 - "Error: Invalid filter parameter" on mass update

This commit is contained in:
acognet
2021-03-31 01:20:03 +02:00
parent 5be3496c8f
commit efeedcad30
5 changed files with 41 additions and 18 deletions

View File

@@ -2594,14 +2594,14 @@ JS
$oPage->set_title(Dict::Format('UI:ModificationPageTitle_Object_Class', $this->GetRawName(), $sClassLabel)); // Set title will take care of the encoding
}
$oToolbarTop = ToolbarUIBlockFactory::MakeStandard(null, ['ibo-toolbar-top']);
$oToolbarButtons = ToolbarUIBlockFactory::MakeStandard(null);
$oCancelButton = ButtonUIBlockFactory::MakeForCancel();
$oCancelButton->AddCSSClasses(['action', 'cancel']);
$oToolbarTop->AddSubBlock($oCancelButton);
$oToolbarButtons->AddSubBlock($oCancelButton);
$oApplyButton = ButtonUIBlockFactory::MakeForPrimaryAction($sApplyButton, null, null, true);
$oApplyButton->AddCSSClass('action');
$oToolbarTop->AddSubBlock($oApplyButton);
$oToolbarButtons->AddSubBlock($oApplyButton);
$aTransitions = $this->EnumTransitions();
if (!isset($aExtraParams['custom_operation']) && count($aTransitions)) {
@@ -2616,7 +2616,7 @@ JS
$oButton = ButtonUIBlockFactory::MakeForPrimaryAction($aStimuli[$sStimulusCode]->GetLabel(), 'next_action', $sStimulusCode, true);
$oButton->AddCSSClass('action');
$oButton->SetColor(Button::ENUM_COLOR_NEUTRAL);
$oToolbarTop->AddSubBlock($oButton);
$oToolbarButtons->AddSubBlock($oButton);
break;
default:
@@ -2680,16 +2680,22 @@ EOF
$oTitle = TitleUIBlockFactory::MakeForPageWithIcon($sTitle, $sClassIcon, Title::DEFAULT_ICON_COVER_METHOD, false);
$oObjectDetails = PanelUIBlockFactory::MakeForClass(get_class($this), '');
$oObjectDetails->SetTitleBlock($oTitle);
$oToolbarButtons->AddCSSClass('ibo-toolbar--button');
} else {
$oObjectDetails = ObjectFactory::MakeDetails($this, $sMode);
$oToolbarButtons->AddCSSClass('ibo-toolbar-top');
$oObjectDetails->AddToolbarBlock($oToolbarButtons);
}
$oForm->AddSubBlock($oObjectDetails);
if (isset($aExtraParams['nbBulkObj'])) {
// if bulk modify buttons must be after object display
$oForm->AddSubBlock($oToolbarButtons);
}
$oPage->AddTabContainer(OBJECT_PROPERTIES_TAB, $sPrefix, $oObjectDetails);
$oPage->SetCurrentTabContainer(OBJECT_PROPERTIES_TAB);
$oPage->SetCurrentTab('UI:PropertiesTab');
$oPage->p($sStatesSelection);
$oObjectDetails->AddToolbarBlock($oToolbarTop);
$aFieldsMap = $this->DisplayBareProperties($oPage, true, $sPrefix, $aExtraParams);
if (!is_array($aFieldsMap)) {
@@ -4734,8 +4740,6 @@ EOF
$oForm = FormUIBlockFactory::MakeStandard('')->SetAction($sFormAction);
$oP->AddSubBlock($oForm);
$oForm->AddSubBlock($oPanel);
$oToolbarTop = ToolbarUIBlockFactory::MakeStandard(null, ['ibo-toolbar-top']);
$oPanel->AddToolbarBlock($oToolbarTop);
$oPanel->SetTitleBlock($oTitle);
$oAppContext = new ApplicationContext();
@@ -4747,8 +4751,13 @@ EOF
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('class', $sClass));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('preview_mode', 0));
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('transaction_id', utils::GetNewTransactionId()));
$oToolbarTop->AddSubBlock(ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel'))->SetOnClickJsCode("window.location.href='$sCancelUrl'"));
$oToolbarTop->AddSubBlock(ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:ModifyAll'), '', '', true));
$oToolbarButtons = ToolbarUIBlockFactory::MakeStandard(null);
$oToolbarButtons->AddCSSClass('ibo-toolbar--button');
$oForm->AddSubBlock($oToolbarButtons);
$oToolbarButtons->AddSubBlock(ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel'))->SetOnClickJsCode("window.location.href='$sCancelUrl'"));
$oToolbarButtons->AddSubBlock(ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:ModifyAll'), '', '', true));
foreach ($_POST as $sKey => $value) {
if (preg_match('/attr_(.+)/', $sKey, $aMatches)) {
// Beware: some values (like durations) are passed as arrays

View File

@@ -59,11 +59,17 @@ $ibo-input-select--action-button--padding-right: 2px !default;
}
.ibo-input-selectize {
min-width: $ibo-input-select-selectize--value--min-midth !important;
>div{
> div {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
> input {
background-color: unset;
border: unset;
}
}
.ibo-input-select-wrapper{
position:relative;

View File

@@ -258,8 +258,11 @@ function DisplayMultipleSelectionForm(WebPage $oP, DBSearch $oFilter, string $sN
//by default all the elements are selected
$aExtraParams['selectionMode'] = 'negative';
$oForm->AddSubBlock($oDisplayBlock->GetDisplay($oP, 1, $aExtraParams));
$oForm->AddSubBlock(ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel'), 'cancel')->SetOnClickJsCode('window.history.back()'));
$oForm->AddSubBlock(ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Next'), 'next', Dict::S('UI:Button:Next'), true));
$oToolbarButtons = ToolbarUIBlockFactory::MakeStandard(null);
$oToolbarButtons->AddCSSClass('ibo-toolbar--button');
$oForm->AddSubBlock($oToolbarButtons);
$oToolbarButtons->AddSubBlock(ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel'), 'cancel')->SetOnClickJsCode('window.history.back()'));
$oToolbarButtons->AddSubBlock(ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Next'), 'next', Dict::S('UI:Button:Next'), true));
$oP->AddUiBlock($oForm);
}
@@ -1933,7 +1936,7 @@ class UI
// Add user filter
$oFilter->UpdateContextFromUser();
$oChecker = new ActionChecker($oFilter, UR_ACTION_BULK_MODIFY);
$oP->add("<h1>".Dict::S('UI:ModifyAllPageTitle')."</h1>\n");
$oP->AddUiBlock(TitleUIBlockFactory::MakeForPage(Dict::S('UI:ModifyAllPageTitle')));
DisplayMultipleSelectionForm($oP, $oFilter, 'form_for_modify_all', $oChecker);
}

View File

@@ -82,16 +82,20 @@ var oTable{{ sListId }} = $('#{{ oUIBlock.GetId() }}').DataTable({
ordering: true,
{% if oUIBlock.GetOption("select_mode") is not empty %}
select: {
style: "{{ oUIBlock.GetOption("select_mode") }}"
style: "{% if oUIBlock.GetOption("select_mode") == "multiple" %}multi{% else %}single{% endif %}",
info: false
},
rowCallback: function (oRow, oData) {
if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative")
{
if (oSelectedItems{{ sListId }}.indexOf(oData.id) === -1) {
if (oSelectedItems{{ sListId }}.indexOf(oData.id) === -1)
{
$(oRow).select();
$(oRow).find('td:first-child input').prop('checked', true);
}
} else {
}
else
{
if (oSelectedItems{{ sListId }}.indexOf(oData.id) > -1)
{
$(oRow).select();

View File

@@ -11,9 +11,10 @@ var table{{ oUIBlock.GetId()|sanitize(constant('utils::ENUM_SANITIZATION_FILTER_
dom: "t",
"order": [],
{% if oUIBlock.GetOption("select_mode") is not empty %}
{% if oUIBlock.GetOption("select_mode") !="custom" %}
{% if oUIBlock.GetOption("select_mode") != "custom" %}
select: {
style: "{{ oUIBlock.GetOption("select_mode") }}"
style: "{% if oUIBlock.GetOption("select_mode") == "multiple" %}multi{% else %}single{% endif %}",
info: false
},
{% endif %}
columnDefs: [