Bugzilla – Attachment 148688 Details for
Bug 28366
Add batch patron modification to patron search results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28366: Add batch patron modification to patron search results
Bug-28366-Add-batch-patron-modification-to-patron-.patch (text/plain), 8.44 KB, created by
Kyle M Hall (khall)
on 2023-03-24 17:46:46 UTC
(
hide
)
Description:
Bug 28366: Add batch patron modification to patron search results
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2023-03-24 17:46:46 UTC
Size:
8.44 KB
patch
obsolete
>From 6a53f77397bfc7b7175be2e359cf0b1e8ccd8626 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 12 Oct 2022 18:24:01 +0000 >Subject: [PATCH] Bug 28366: Add batch patron modification to patron search > results > >This patch adds the ability to send selected patrons for batch >modification. It does this by adding a hidden form which is populated >from the borrowernumbers stored in the browser's localStorage when >selections are made. > >To test, apply the patch and perform a patron search in the staff client >which will return multiple pages of results. > >- Select a patron on the first page of results. >- The "Add to patron list" and "Batch patron modification" buttons > should become active, and the "Patrons selected" box should show "1" >- After checking another checkbox the "Merge selected patrons" button > should activate and the "selected" count should increment. >- Test making selections on other pages of results. The "selected" count > should continue to increment. >- Test the "Batch patron modification" button, confirming that all the > patrons you selected are correctly passed to the batch patron > modification tool. >- Test that the "Clear" control works correctly to clear all checkboxes > and disable all other buttons. >- Test that the "Select all" and "Clear all" controls work correctly, > enabling all buttons and correctly incrementing the "selected" count. > >Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../prog/en/modules/members/member.tt | 58 +++++++++++++------ > 1 file changed, 40 insertions(+), 18 deletions(-) > >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 923ecd10748..1df54b9c80b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >@@ -96,8 +96,17 @@ > [% END %] > > [% IF CAN_user_borrowers_edit_borrowers %] >- <button id="merge-patrons" class="btn btn-sm btn-default disabled" disabled="disabled" type="submit"><i class="fa fa-compress" aria-hidden="true"></i> Merge selected patrons</button> >+ <div class="btn-group"> >+ <button id="merge-patrons" class="btn btn-sm btn-default disabled" disabled="disabled" type="submit"><i class="fa fa-compress" aria-hidden="true"></i> Merge selected patrons</button> >+ </div> >+ [% END %] >+ >+ [% IF CAN_user_tools_edit_patrons %] >+ <div class="btn-group"> >+ <button id="batch-mod-patrons" class="btn btn-default btn-sm" type="button"><i class="fa fa-pencil" aria-hidden="true"></i> Batch patron modification</button> >+ </div> > [% END %] >+ > <div id="patron_search_selected" class="btn-group" style="display:none;"> > <span></span> > <a href="#" id="clear-patron-selection"><i class="fa fa-remove"></i> Clear</a> >@@ -111,6 +120,12 @@ > [% END %] > [% PROCESS patron_search_table table_id => 'memberresultst' columns => columns %] > </div> >+ [% IF CAN_user_tools_edit_patrons %] >+ <form id="patron_batchmod_form" method="post" action="/cgi-bin/koha/tools/modborrowers.pl"> >+ <input type="hidden" name="op" value="show" /> >+ <textarea style="display:none" id="borrowernumberlist" name="borrowernumberlist"></textarea> >+ </form> >+ [% END %] > > </main> > </div> <!-- /.col-sm-10.col-sm-push-2 --> >@@ -159,7 +174,7 @@ > } > > $(document).ready(function() { >- $('#merge-patrons').prop('disabled', true); >+ $('#merge-patrons, #batch-mod-patrons').prop('disabled', true); > $('#memberresultst').on('change', 'input.selection', function() { > var patron_search_selections = JSON.parse( localStorage.getItem("patron_search_selections") ) || []; > var borrowernumber = $(this).val(); >@@ -182,17 +197,16 @@ > } > } > if ( patron_search_selections.length > 1 ) { >- /* More than one checkbox has been checked */ >- $('#merge-patrons').prop('disabled', false).removeClass("disabled"); >- $("#patronlist-menu").removeClass("disabled").prop("disabled", false); >+ /* More than one checkbox has been checked. All batch options enabled */ >+ $("#batch-mod-patrons, #merge-patrons, #patronlist-menu").removeClass("disabled").prop("disabled", false); > } else if ( patron_search_selections.length == 1 ) { >- /* At least one checkbox has been checked */ >+ /* Only one checkbox has been checked */ >+ $("#batch-mod-patrons, #patronlist-menu").removeClass("disabled").prop("disabled", false); >+ /* Merge requires more than one selection */ > $('#merge-patrons').prop('disabled', true).addClass("disabled"); >- $("#patronlist-menu").removeClass("disabled").prop("disabled", false); > } else { >- /* No checkbox has been checked */ >- $('#merge-patrons').prop('disabled', true).addClass("disabled"); >- $("#patronlist-menu").addClass("disabled").prop("disabled", true); >+ /* No checkbox has been checked. No batch options enabled */ >+ $("#batch-mod-patrons, #merge-patrons, #patronlist-menu").addClass("disabled").prop("disabled", true); > } > }); > >@@ -204,11 +218,11 @@ > > $("#clear-patron-selection").on("click", function(e){ > e.preventDefault(); >- $(".selection").prop("checked", false).change(); >+ $("input.selection").prop("checked", false).change(); > localStorage.removeItem("patron_search_selections"); > $("#patron_search_selected").hide(); >- $('#merge-patrons').prop('disabled', true).addClass("disabled"); >- $("#patronlist-menu").addClass("disabled").prop("disabled", true); >+ $('#merge-patrons, #patronlist-menu, #batch-mod-patrons').prop('disabled', true).addClass("disabled"); >+ $("#borrowernumberlist").val(""); > }); > > $("#patronlist-dropdown").on("click", ".patron-list-add", function(e){ >@@ -230,7 +244,16 @@ > > patronListAdd(); > } >- }) >+ }); >+ >+ $("#batch-mod-patrons").on("click", function(e) { >+ e.preventDefault(); >+ var patron_search_selections = JSON.parse( localStorage.getItem("patron_search_selections") ) || []; >+ if( patron_search_selections.length > 0 ){ >+ $("#borrowernumberlist").html( patron_search_selections.join('\n') ); >+ $("#patron_batchmod_form").submit(); >+ } >+ }); > > /* Submit selected patrons to a list via AJAX */ > $("#new-patron-list_form").on('submit', function(e){ >@@ -255,7 +278,7 @@ > > $("#select_all").on("click",function(e){ > e.preventDefault(); >- $(".selection").each(function(){ >+ $("input.selection").each(function(){ > if( $(this).prop("checked") == false ){ > $(this).prop( "checked", true ).change(); > } >@@ -263,7 +286,7 @@ > }); > $("#clear_all").on("click",function(e){ > e.preventDefault(); >- $(".selection").each(function(){ >+ $("input.selection").each(function(){ > if( $(this).prop("checked") ){ > $(this).prop("checked", false ).change(); > } >@@ -339,8 +362,7 @@ > }); > > if( selected_patrons.length > 1 ){ >- $('#merge-patrons').removeClass("disabled").prop('disabled', false); >- $('#patronlist-menu').removeClass("disabled").prop('disabled', false); >+ $('#batch-mod-patrons, #merge-patrons, #patronlist-menu').removeClass("disabled").prop('disabled', false); > } > } > } >-- >2.30.2
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 28366
:
146641
|
147979
| 148688