From dcb98892cdde4c4c8dac4fcfb90d26b436877c09 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Mon, 25 Mar 2024 17:14:01 +0000 Subject: [PATCH] Bug 36302: Reinstate defer_loading defer_loading is now a patron_search_js BLOCK param - default on Signed-off-by: Jonathan Druart Signed-off-by: Katrin Fischer --- koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc | 6 +++--- koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc index 8089683e3e..28e87b47ca 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc @@ -226,6 +226,7 @@ [%# callback: name of the JS function that will be called when a patron is selected. Only work with action=select %] [%# display_search_description: boolean, default off. Display the description of the search %] [%# adjust_history: boolean, default off. Change the current url when a first letter is selected %] +[%# defer_loading: boolean, default on. If true, it will not load the table until a search is triggered %] [% BLOCK patron_search_js %] [% IF redirect_if_one_result && !redirect_url %] @@ -293,7 +294,7 @@ let Sticky; let singleBranchMode = '[% singleBranchMode | html %]'; let logged_in_library_id = "[% Branches.GetLoggedInBranchcode | html %]"; - + let defer_loading = Number( '[% defer_loading | html %]' || 1 ); [% IF adjust_history %] /* popstate event triggered by forward and back button. Need to refresh search */ window.addEventListener('popstate', (event) => { @@ -724,8 +725,7 @@ patron_search_form.find(".searchpattern").parent().hide(); }); - let urlParams = new URLSearchParams(window.location.search); - if(urlParams.size > 0){ + if ( !defer_loading ) { patron_search_form.submit(); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt index 31f849ee78..7bc63c9e72 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt @@ -347,7 +347,7 @@ [% ELSE %] [% SET redirect_url = '/cgi-bin/koha/members/moremember.pl' %] [% END %] - [% PROCESS patron_search_js table_id => 'memberresultst', categories => categories, libraries => libraries, columns => columns,actions => ['edit', 'checkout'], redirect_if_one_result => 1, redirect_url => redirect_url, sticky_header => "searchheader", sticky_to => "searchresults", default_sort_column => 'name-address', display_search_description => 1, remember_selections => 1, adjust_history => 1 %] + [% PROCESS patron_search_js defer_loading => defer_loading, table_id => 'memberresultst', categories => categories, libraries => libraries, columns => columns,actions => ['edit', 'checkout'], redirect_if_one_result => 1, redirect_url => redirect_url, sticky_header => "searchheader", sticky_to => "searchresults", default_sort_column => 'name-address', display_search_description => 1, remember_selections => 1, adjust_history => 1 %] [% END %] [% INCLUDE 'intranet-bottom.inc' %] -- 2.39.5