Bugzilla – Attachment 148489 Details for
Bug 28726
Add sort1 and sort2 to patron card creator patron search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28726: Add sort1 and sort2 to patron card creator - patron search.
Bug-28726-Add-sort1-and-sort2-to-patron-card-creat.patch (text/plain), 10.12 KB, created by
solene.ngamga
on 2023-03-21 17:30:09 UTC
(
hide
)
Description:
Bug 28726: Add sort1 and sort2 to patron card creator - patron search.
Filename:
MIME Type:
Creator:
solene.ngamga
Created:
2023-03-21 17:30:09 UTC
Size:
10.12 KB
patch
obsolete
>From 49b5a824517a59b8bd614f1437eabc261fd0a6ba Mon Sep 17 00:00:00 2001 >From: Michael Hafen <michael.hafen@washk12.org> >Date: Tue, 20 Jul 2021 12:12:42 -0600 >Subject: [PATCH] Bug 28726: Add sort1 and sort2 to patron card creator - > patron search. > >Also adds a select all / clear all and checkboxes. > >Test plan: > >1. start a new batch in the patron card creator (Tools -> Patron card creator -> New -> card batch) >2. click the Add patron(s) button. Observe that Category and Library are the only options. >3. Close search for patron window. >4. Apply patch. >5. click the Add patron(s) button. Observe that you can now search for patrons by their sort1 and sort2 values. >6. perform a search and observe the 'Select all | Clear all | Add selected patrons' links and button. >7. use the Select all link to select all the patrons found by the search. >8. use the Add selected patrons button to add the selected patrons to the card batch's Add by borrowernumber(s) text input field. >9. close the search for patron window. > >Signed-off-by: Solene Ngamga <solene.ngamga@inLibro.com> >--- > .../prog/en/includes/patron-search.inc | 60 ++++++++++++++++++- > .../prog/en/modules/members/search.tt | 45 +++++++++++++- > .../prog/en/modules/patroncards/edit-batch.tt | 2 +- > 3 files changed, 103 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 6651424b83..34dd0801e6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >@@ -56,6 +56,16 @@ > [% END %] > </select> > </li> >+ [% CASE 'sort1' %] >+ <li> >+ <label for="sort1_filter">Sort1:</label> >+ [% PROCESS 'av-build-dropbox.inc' name="sort1_filter", category="Bsort1", empty=1, size = 20 %] >+ </li> >+ [% CASE 'sort2' %] >+ <li> >+ <label for="sort2_filter">Sort2:</label> >+ [% PROCESS 'av-build-dropbox.inc' name="sort2_filter", category="Bsort2", empty=1, size = 20 %] >+ </li> > [% CASE 'search_field' %] > <li> > [% INCLUDE patron_fields_dropdown %] >@@ -197,6 +207,8 @@ > [% IF redirect_if_one_result && !redirect_url %] > <script>console.log("Wrong call of patron_searh_js - missing redirect_url");</script> > [% END %] >+ >+ [% INCLUDE 'select2.inc' %] > <script> > let categories = [% To.json(categories) | $raw %].map(e => { > e['_id'] = e.categorycode.toLowerCase(); >@@ -221,6 +233,10 @@ > let extended_attribute_types = [% To.json(extended_attribute_types || []) | $raw %]; > [% END %] > >+ $(document).ready(function() { >+ $('select#sort1_filter').select2({allowClear:true}); >+ $('select#sort2_filter').select2({allowClear:true}); >+ }); > </script> > > [% INCLUDE 'datatables.inc' %] >@@ -298,11 +314,31 @@ > return { "like": start_with + "%" } > }, > "-and": function(){ >+ let filters = []; >+ let f_sort1 = $("#sort1_filter").val(); >+ if ( f_sort1 ) { >+ filters.push({ >+ "me.sort1": f_sort1 >+ }); >+ } >+ let f_sort2 = $("#sort2_filter").val(); >+ if ( f_sort2 ) { >+ filters.push({ >+ "me.sort2": f_sort2 >+ }); >+ } >+ > let pattern = $("#search_patron_filter").val(); >- if (!pattern) return ""; >+ if (!pattern) { >+ if ( filters.length == 0 ) { >+ return ""; >+ } >+ else { >+ return filters; >+ } >+ } > let patterns = pattern.split(/[\s,]+/).filter(function(s){ return s.length }); > >- let filters = []; > let search_type = $("#searchtype_filter").val() || "contain"; > let search_fields = $("#searchfieldstype_filter").val(); > if ( !search_fields ) { >@@ -733,6 +769,24 @@ > if ( $("#branchcode_filter").val() ) { > searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text(); > } >+ if ( $("#sort1_filter").val() ) { >+ searched += _(" with sort1 ") >+ if ( $("select#sort1_filter") ) { >+ searched += $("select#sort1_filter").find("option:selected").text(); >+ } >+ else { >+ searched += $("#sort1_filter").val(); >+ } >+ } >+ if ( $("#sort2_filter").val() ) { >+ searched += _(" with sort2 "); >+ if ( $("select#sort2_filter") ) { >+ searched += $("select#sort2_filter").find("option:selected").text(); >+ } >+ else { >+ searched += $("#sort2_filter").val(); >+ } >+ } > $("#searchpattern").text(searched); > $("#searchpattern").parent().show(); > } >@@ -790,6 +844,8 @@ > $("#searchtype_filter option[value='contain']").prop("selected", true); > $("#categorycode_filter option:first").prop("selected", true); > $("#branchcode_filter option:first").prop("selected", true); >+ $("#sort1_filter").val('').trigger("change"); >+ $("#sort2_filter").val('').trigger("change"); > $("#firstletter_filter").val(''); > $("#search_patron_filter").val(''); > /* remove any search string added by firstletter search */ >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt >index fecba041ea..6146eebe5c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt >@@ -17,10 +17,24 @@ > <div id="patron_search"> > <div class="container-fluid"> > >- [% PROCESS patron_search_filters categories => categories, libraries => libraries, filters => ['branch', 'category'], search_filter => searchmember %] >+ [% PROCESS patron_search_filters categories => categories, libraries => libraries, filters => ['branch','category','sort1','sort2'], search_filter => searchmember %] > </form> > >+ <div id="searchresults"> >+ <div class="searchheader fh-fixedHeader" id="searchheader" style="display:none;"> >+ <div> >+ [% IF columns.grep('checkbox').size %] >+ <a href="#" class="btn btn-link" id="select_all"><i class="fa fa-check"></i> Select all</a> >+ | >+ <a href="#" class="btn btn-link" id="clear_all"><i class="fa fa-remove"></i> Clear all</a> >+ [% IF selection_type == 'add' %] >+ <button id="add-selected" class="btn btn-sm btn-default" type="submit">Add selected patrons</button> >+ [% END %] >+ [% END %] >+ </div> >+ </div> > [% PROCESS patron_search_table table_id => 'memberresultst' columns => columns %] >+ </div> > > <div id="closewindow"><a href="#" class="btn btn-default btn-default close">Close</a></div> > >@@ -28,6 +42,35 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+<script> >+ $(document).ready(function() { >+ $("#select_all").on("click",function(e){ >+ e.preventDefault(); >+ $(".selection").prop("checked", true).change(); >+ }); >+ $("#clear_all").on("click",function(e){ >+ e.preventDefault(); >+ $(".selection").prop("checked", false).change(); >+ }); >+ $("#searchheader").hide(); >+ $("#patron_search_form").on('submit', function(){$("#searchheader").show();}); >+ $("#clear_search").on("click",function(e){$("#searchheader").hide();}); >+ >+ $('#add-selected').on('click', function(e) { >+ e.preventDefault(); >+ var counter = 0; >+ $('tr:has(.selection:checked) .add_user').each(function(){ >+ var borrowernumber = $(this).data('borrowernumber'); >+ var firstname = $(this).data('firstname'); >+ var surname = $(this).data('surname'); >+ add_user( borrowernumber, firstname + ' ' + surname ); >+ counter++; >+ }); >+ $('#info').html(_("%s Patrons added.").format(counter)); >+ }); >+ }); >+</script> >+ > [% PROCESS patron_search_js table_id => 'memberresultst', categories => categories, libraries => libraries, extended_attribute_types => attribute_type_codes, columns => columns, filter => filter, actions => [selection_type], preview_on_name_click => 1, callback => callback %] > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt >index 58615048b9..22228fd70a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt >@@ -195,7 +195,7 @@ > function Add() { > var bor_nums = document.getElementById("bor_num_list"); > if (bor_nums.value == '') { >- window.open("/cgi-bin/koha/members/search.pl?columns=cardnumber,name,category,branch,dateexpiry,borrowernotes,action&selection_type=add", >+ window.open("/cgi-bin/koha/members/search.pl?columns=checkbox,cardnumber,name,category,branch,dateexpiry,borrowernotes,action&selection_type=add", > 'PatronPopup', > 'width=1024,height=768,location=yes,toolbar=no,' > + 'scrollbars=yes,resize=yes'); >-- >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 28726
:
122991
|
129203
|
134003
|
137854
|
138552
|
138653
|
141405
|
143646
|
147477
|
148489
|
150650