Bugzilla – Attachment 173460 Details for
Bug 33484
Ability to remember user's selected table configuration and search filters for tables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33484: Fix patrons search
Bug-33484-Fix-patrons-search.patch (text/plain), 4.40 KB, created by
Jonathan Druart
on 2024-10-28 09:45:21 UTC
(
hide
)
Description:
Bug 33484: Fix patrons search
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-10-28 09:45:21 UTC
Size:
4.40 KB
patch
obsolete
>From 9825269d24afd7a2649c8b5864c4247025bb9e33 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 8 Oct 2024 10:40:17 +0200 >Subject: [PATCH] Bug 33484: Fix patrons search > >Setting a DT's custom setting to know if we loaded an existing state, so >that we do not pick the value of the selects from the form (on the >left). > >Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../prog/en/includes/patron-search.inc | 27 ++++++++++--------- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 3 +++ > 2 files changed, 18 insertions(+), 12 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 2046e69f7d6..f53918f5f86 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >@@ -869,19 +869,22 @@ > $("#[% table_id | html %]_search_results").show(); > > let table_dt = patrons_table.DataTable(); >- [% FOR c IN columns %] >- [% SWITCH c %] >- [% CASE 'branch' %] >- let library_id = patron_search_form.find(".branchcode_filter").val() || ""; >- patrons_table.find('thead tr:eq(1) th[data-filter="libraries"] select').val(library_id); >- table_dt.column([% loop.count - 1 %]).search(library_id ? '^'+library_id+'$' : ''); >- [% CASE 'category' %] >- let category_id = patron_search_form.find(".categorycode_filter").val() || ""; >- patrons_table.find('thead tr:eq(1) th[data-filter="categories"] select').val(category_id.toLowerCase()); >- table_dt.column([% loop.count - 1 %]).search(category_id ? '^'+category_id+'$' : ''); >+ let loaded_from_state = table_dt.settings()[0].loaded_from_state; >+ if ( !loaded_from_state ) { >+ [% FOR c IN columns %] >+ [% SWITCH c %] >+ [% CASE 'branch' %] >+ let library_id = patron_search_form.find(".branchcode_filter").val() || ""; >+ patrons_table.find('thead tr:eq(1) th[data-filter="libraries"] select').val(library_id); >+ table_dt.column([% loop.count - 1 %]).search(library_id ? '^'+library_id+'$' : ''); >+ [% CASE 'category' %] >+ let category_id = patron_search_form.find(".categorycode_filter").val() || ""; >+ patrons_table.find('thead tr:eq(1) th[data-filter="categories"] select').val(category_id.toLowerCase()); >+ table_dt.column([% loop.count - 1 %]).search(category_id ? '^'+category_id+'$' : ''); >+ [% END %] > [% END %] >- [% END %] >- table_dt.search(""); >+ table_dt.search(""); >+ } > first_draw = 1; // Only redirect if we are coming from here > table_dt.draw(); > [% IF display_search_description %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 09a7c139890..b9f7a90973d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -979,6 +979,7 @@ function _dt_save_restore_state(table_settings){ > const url = new URL(window.location.href); > let state_from_url = url.searchParams.get( settings.nTable.id + '_state'); > if ( state_from_url ) { >+ settings.loaded_from_state = true; > return JSON.parse(atob(state_from_url)); > } > >@@ -993,6 +994,7 @@ function _dt_save_restore_state(table_settings){ > delete state.search; > state.columns.forEach(c => delete c.search ); > } >+ settings.loaded_from_state = true; > return state; > } > >@@ -1040,6 +1042,7 @@ function _dt_save_restore_state(table_settings){ > 'emptyTable': (options.emptyTable) ? options.emptyTable : __("No data available in table") > }, > 'ajax': _dt_default_ajax({default_filters, options}), >+ loaded_from_state: false, > }, options); > } > >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33484
:
149444
|
149445
|
149447
|
149448
|
149449
|
149925
|
149926
|
149927
|
149928
|
149929
|
149930
|
149974
|
149975
|
149976
|
149977
|
149978
|
149979
|
173443
|
173444
|
173445
|
173446
|
173447
|
173448
|
173449
|
173450
|
173451
|
173452
|
173453
|
173454
|
173455
|
173456
|
173457
|
173458
|
173459
| 173460 |
173461
|
173462
|
173463
|
173464
|
173465
|
173466
|
173467
|
173468
|
173469
|
173470
|
173471
|
173472
|
173473
|
173474
|
173475
|
173476
|
173477
|
173478
|
173479
|
173480
|
173481
|
173482
|
173483
|
173484
|
173485
|
173486
|
173546
|
173606
|
173607
|
173985
|
174219