Bug 36132: Allow to delete multiple patron lists on any page

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Phan Tung Bui 2024-02-19 14:17:42 -05:00 committed by Katrin Fischer
parent 411a885829
commit e1031b88f0
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -1,13 +1,8 @@
[% USE raw %]
[% USE Asset %]
[% PROCESS 'i18n.inc' %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% FILTER collapse %]
[% t("Patron lists") | html %] &rsaquo;
[% t("Tools") | html %] &rsaquo;
[% t("Koha") | html %]
[% END %]</title>
<title>Patron lists &rsaquo; Tools &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'greybox.inc' %]
</head>
@ -32,7 +27,6 @@
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% INCLUDE 'messages.inc' %]
<div id="toolbar" class="btn-toolbar">
<div class="btn-group">
@ -40,7 +34,7 @@
</div>
</div>
<h1>Patron lists</h1>
<h1>Your patron lists </h1>
[% IF ( lists ) %]
@ -83,8 +77,8 @@
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="listactions[% l.patron_list_id | html %]">
<li><a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id | uri %]"><i class="fa fa-user"></i> Add patrons</a></li>
[% UNLESS shared_by_other %]
<li><a href="/cgi-bin/koha/patron_lists/add-modify.pl?patron_list_id=[% l.patron_list_id | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit list</a></li>
<li><a class="delete_patron" href="/cgi-bin/koha/patron_lists/delete.pl?patron_list_id=[% l.patron_list_id | html %]" data-list-name="[% l.name | html %]"><i class="fa fa-trash-can"></i> Delete list</a></li>
<li><a href="/cgi-bin/koha/patron_lists/add-modify.pl?patron_list_id=[% l.patron_list_id | uri %]"><i class="fa fa-pencil"></i> Edit list</a></li>
<li><a class="delete_patron" href="/cgi-bin/koha/patron_lists/delete.pl?patron_list_id=[% l.patron_list_id | html %]" data-list-name="[% l.name | html %]"><i class="fa fa-trash"></i> Delete list</a></li>
[% END %]
[% IF ( l.patron_list_patrons_rs.count ) %]
<li class="divider"></li>
@ -94,14 +88,14 @@
[% IF CAN_user_tools_edit_patrons %]
<li>
<a href="/cgi-bin/koha/tools/modborrowers.pl?patron_list_id=[% l.patron_list_id | uri %]&op=show">
<i class="fa-solid fa-pencil" aria-hidden="true"></i> Batch edit patrons
<i class="fa fa-pencil"></i> Batch edit patrons
</a>
</li>
[% END %]
[% IF CAN_user_tools_delete_anonymize_patrons %]
<li>
<a href="/cgi-bin/koha/tools/cleanborrowers.pl?step=2&patron_list_id=[% l.patron_list_id | uri %]&checkbox=borrower">
<i class="fa fa-trash-can"></i> Batch delete patrons
<i class="fa fa-trash"></i> Batch delete patrons
</a>
</li>
[% END %]
@ -147,8 +141,8 @@
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/tools-menu.js") | $raw %]
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function() {
var patronExportModal = $("#patronExportModal");
var patronExportModalBody = $("#patronExportModal .modal-body");
@ -157,10 +151,10 @@
$('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults, {
"autoWidth": false,
"columnDefs": [
{ "orderable": false, "searchable": false, "targets": [ 'NoSort' ] }
"aoColumnDefs": [
{"bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ]}
],
"pagingType": "full"
"sPaginationType": "full"
} ));
$(".delete_patron").on("click", function(){
$(".dropdown").removeClass("open");
@ -177,18 +171,18 @@
}
});
$(".select_patron").on("click", function() {
if($(this).is(':checked')){
$("#delete_selected_lists").attr("class","btn btn-default btn-sm");
selectedPatronLists.push($(this).data("patron-list-id"));
$(document).on("click", ".select_patron", function() {
if($(this).is(':checked')){
$("#delete_selected_lists").attr("class","btn btn-default btn-sm");
selectedPatronLists.push($(this).data("patron-list-id"));
}
else {
selectedPatronLists = selectedPatronLists.filter(item => item !== $(this).data("patron-list-id"));
if(selectedPatronLists.length === 0){
$("#delete_selected_lists").attr("class","btn btn-default btn-sm disabled");
}
else {
selectedPatronLists = selectedPatronLists.filter(item => item !== $(this).data("patron-list-id"));
if(selectedPatronLists.length === 0){
$("#delete_selected_lists").attr("class","btn btn-default btn-sm disabled");
}
}
});
}
});
$(".print_cards").on("click", function(e){
e.preventDefault();