Bug 34479: Add new files to templates

This patch adds two newly created files to the templates to allow the patron selection history to be wiped or persisted as appropriate

Test plan as per previous commit

Signed-off-by: Sharon Dugdale <sharon.dugdale@cumberland.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Matt Blenkinsop 2023-11-27 10:42:09 +00:00 committed by Katrin Fischer
parent 963a3a4715
commit 2de99d0b02
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
3 changed files with 9 additions and 24 deletions

View File

@ -155,6 +155,7 @@
<div class="modal-footer">
<button type="submit" id="add_to_patron_list_submit" class="btn btn-default approve">Submit</button>
<button type="button" class="btn btn-default deny" data-dismiss="modal">Cancel</button>
[% PROCESS 'members-patron-selections.inc' id="new-patron-list_form" %]
</div> <!-- /.modal-footer -->
</form> <!-- /#new-patron-list_form -->
</div> <!-- /.modal-content -->
@ -166,12 +167,9 @@
[% INCLUDE 'columns_settings.inc' %]
[% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") | $raw %]
[% Asset.js("js/members-patron-selections.js") | $raw %]
[% INCLUDE 'select2.inc' %]
<script>
function showPatronSelections( number ){
$("#table_search_selections").show().find("span").text(_("Patrons selected: " + number ) );
}
$(document).ready(function() {
$('#merge-patrons, #batch-mod-patrons').prop('disabled', true);
$('#memberresultst').on('change', 'input.selection', function() {
@ -335,6 +333,8 @@
/* Add a new entry to the menu */
$("#patronlist-dropdown .divider").before('<li><a class="patron-list-add" href="#" data-listid="' + data.patron_list.patron_list_id + '">' + data.patron_list.name + '</li>');
}
persistPatronSelections('new-patron-list_form');
prepSelections();
},
error: function() {
alert( _("An error occurred. Patron list could not be updated.") );
@ -347,25 +347,6 @@
}
}
function prepSelections(){
var selected_patrons = JSON.parse( localStorage.getItem("patron_search_selections") );
if( selected_patrons && selected_patrons.length > 0 ){
showPatronSelections( selected_patrons.length );
$('#merge-patrons').prop('disabled', true);
$("input.selection").each(function(){
var cardnumber = $(this).val();
if( selected_patrons.indexOf( cardnumber ) >= 0 ){
$(this).prop("checked", true );
}
});
if( selected_patrons.length > 1 ){
$('#batch-mod-patrons, #merge-patrons, #patronlist-menu').removeClass("disabled").prop('disabled', false);
}
}
}
$('#memberresultst tbody').on('click','td',function(e){
var $checkbox = $(this).find("input[type=checkbox]");
if (e.target.type != "checkbox") {

View File

@ -158,6 +158,7 @@
[% END %]
<input type="hidden" name="action" value="merge" />
<input type="submit" id="merge-patrons" class="btn btn-primary" value="Merge patrons" />
[% PROCESS 'members-patron-selections.inc' id="patron-merge-form" %]
</fieldset>
[% ELSE %]
@ -296,6 +297,7 @@
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") | $raw %]
[% Asset.js("js/members-patron-selections.js") | $raw %]
[% Asset.js("lib/jsdiff/jsdiff.min.js") | $raw %]
<script>
$(document).ready(function() {

View File

@ -219,7 +219,7 @@
[% END %]
[% IF ( op == 'show' ) %]
<form name="f" action="modborrowers.pl" method="post">
<form name="f" action="modborrowers.pl" method="post" id="batchmod-borrowers-form">
<input type="hidden" name="op" value="do" />
[% IF ( borrowers ) %]
<div class="btn-toolbar selections-toolbar"><a id="selectallbutton" href="#"><i class="fa fa-check"></i> Select all</a> | <a id="clearallbutton" href="#"><i class="fa fa-times"></i> Clear all</a></div>
@ -409,6 +409,7 @@
<fieldset class="action">
<input type="submit" name="mainformsubmit" class="btn btn-primary" value="Save" />
<a href="/cgi-bin/koha/tools/modborrowers.pl" class="cancel">Cancel</a>
[% PROCESS 'members-patron-selections.inc' id="batchmod-borrowers-form" %]
</fieldset>
</div>
</form>
@ -436,6 +437,7 @@
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
[% Asset.js("js/tools-menu.js") | $raw %]
[% Asset.js("js/members-patron-selections.js") | $raw %]
<script>
var patron_attributes_lib = new Array();
var patron_attributes_values = new Array();