Bugzilla – Attachment 170936 Details for
Bug 34608
Add sort1 and sort2 to patron search results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34608: Display dropdown list if linked with AV cat
Bug-34608-Display-dropdown-list-if-linked-with-AV-.patch (text/plain), 5.66 KB, created by
Jonathan Druart
on 2024-09-02 12:32:51 UTC
(
hide
)
Description:
Bug 34608: Display dropdown list if linked with AV cat
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-09-02 12:32:51 UTC
Size:
5.66 KB
patch
obsolete
>From c0b55131be163a8b7fea02d04b41f366c9b50a35 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 23 Apr 2024 11:19:22 +0200 >Subject: [PATCH] Bug 34608: Display dropdown list if linked with AV cat > >If at least one AV exists for bsort1 we will show a dropdown list in >the column filter for bsort1. Same for bsort2. > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > .../prog/en/includes/patron-search.inc | 47 +++++++++++++++---- > .../prog/en/modules/circ/circulation.tt | 1 + > 2 files changed, 39 insertions(+), 9 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 d2ca3cc3307..744f422cbff 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >@@ -8,6 +8,8 @@ > [% USE To %] > [% USE AuthorisedValues %] > [% SET search_results_block_id = 'searchresults' %] >+[% SET av_bsort1 = AuthorisedValues.Get('Bsort1') %] >+[% SET av_bsort2 = AuthorisedValues.Get('Bsort2') %] > > [%# Display a simple form %] > [% BLOCK patron_search_filters_simple %] >@@ -178,8 +180,18 @@ > [% CASE 'phone' %]<th>Phone</th> > [% CASE 'checkouts' %]<th>Checkouts</th> > [% CASE 'account_balance' %]<th>Fines</th> >- [% CASE 'sort1' %]<th>Sort 1</th> >- [% CASE 'sort2' %]<th>Sort 2</th> >+ [% CASE 'sort1' %] >+ [% IF av_bsort1.size %] >+ <th data-filter="av_bsort1">Sort 1</th> >+ [% ELSE %] >+ <th>Sort 1</th> >+ [% END %] >+ [% CASE 'sort2' %] >+ [% IF av_bsort2.size %] >+ <th data-filter="av_bsort2">Sort 2</th> >+ [% ELSE %] >+ <th>Sort 2</th> >+ [% END %] > [% CASE 'action' %]<th class="noExport"> </th> > [% END %] > [% END %] >@@ -247,6 +259,26 @@ > return map; > }, {}); > >+ >+ const av_bsort1= [% To.json(av_bsort1) | $raw %].map( e => { >+ e['_id'] = e.authorised_value; >+ e['_str'] = e.lib; >+ return e; >+ }); >+ var av_bsort1_map = av_bsort1.reduce((map, e) => { >+ map[e._id] = e; >+ return map; >+ }, {}); >+ const av_bsort2= [% To.json(av_bsort2) | $raw %].map( e => { >+ e['_id'] = e.authorised_value; >+ e['_str'] = e.lib; >+ return e; >+ }); >+ var av_bsort2_map = av_bsort2.reduce((map, e) => { >+ map[e._id] = e; >+ return map; >+ }, {}); >+ > [% IF Koha.Preference('ExtendedPatronAttributes') %] > [% SET extended_attribute_types = [ ExtendedAttributeTypes.codes( staff_searchable => 1, searched_by_default => 1 ) ] %] > var extended_attribute_types = [% To.json(extended_attribute_types || []) | $raw %]; >@@ -309,9 +341,6 @@ > let patron_search_url = '/api/v1/patrons'; > [% END %] > >- const av_bsort1= new Map([% To.json(AuthorisedValues.Get('Bsort1')) | $raw %].map( av => [av.authorised_value, av.lib])); >- const av_bsort2= new Map([% To.json(AuthorisedValues.Get('Bsort2')) | $raw %].map( av => [av.authorised_value, av.lib])); >- > $(document).ready(function(){ > > let parent_block = $("#[% search_results_block_id | html %]"); >@@ -627,8 +656,8 @@ > "searchable": true, > "orderable": true, > "render": function( data, type, row, meta ) { >- let bsort2_lib = av_bsort2.get( data.toString() ) || data; >- return escape_str( bsort2_lib ); >+ let bsort1 = av_bsort1_map[data.toString()]; >+ return escape_str(bsort1 ? bsort1.lib : data); > } > } > >@@ -638,8 +667,8 @@ > "searchable": true, > "orderable": true, > "render": function( data, type, row, meta ) { >- let bsort1_lib = av_bsort1.get( data.toString() ) || data; >- return escape_str( bsort1_lib ); >+ let bsort2 = av_bsort2_map[data.toString()]; >+ return escape_str(bsort2 ? bsort2.lib : data); > } > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index d4f2b0261f7..f7e73edb53f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -1071,6 +1071,7 @@ > [% FOREACH wh IN waiting_holds %] > waiting_holds_barcodes.push("[% wh.item.barcode | html %]"); > [% END %] >+ console.log(waiting_holds_barcodes); > $("#mainform").on('submit', function(){ > if( $("#checkout_confirmed").length > 0 ){ > return true; >-- >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 34608
:
154729
|
155343
|
158194
|
159544
|
159545
|
159561
|
162592
|
162593
|
165260
|
165360
|
165375
|
167789
|
170624
|
170625
|
170626
|
170809
|
170810
|
170811
|
170812
| 170936 |
170937