Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(SavedSearch): Force user to validate criteria before saved search #18385

Open
wants to merge 1 commit into
base: 10.0/bugfixes
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions js/modules/Search/GenericView.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,20 @@ window.GLPI.Search.GenericView = class GenericView {
</div>
`);
const bs_modal = new bootstrap.Modal(modal.get(0), {show: false});
modal.on('show.bs.modal', () => {
const params = JSON.parse(modal.attr('data-params'));
params['url'] = window.location.pathname + window.location.search;
modal.find('.modal-body').load(CFG_GLPI.root_doc + '/ajax/savedsearch.php', params);
});
bs_modal.show();

if (window.location.search.includes('reset=reset') || window.location.search.trim() === '') {
alert(`${__(
`To save a bookmark correctly, you must first execute the search to validate and record the criteria.
Otherwise, the default search parameters will be saved, which may not match your intended settings.`
)}`);
} else {
modal.on('show.bs.modal', () => {
const params = JSON.parse(modal.attr('data-params'));
params['url'] = window.location.pathname + window.location.search;
modal.find('.modal-body').load(CFG_GLPI.root_doc + '/ajax/savedsearch.php', params);
});
bs_modal.show();
}
});
}

Expand Down