From dfda4e8d34c5e13958910eb6cb4eb57c583e9356 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Mon, 16 Oct 2023 22:20:54 +0000 Subject: [PATCH] Bug 35068: Split RenewCheckinChecked button into seperate renew/checkin buttons To test: 1. APPLY patch, clear browser's cache 2. Have more than 1 checkout issued to a borrower. 3. Load the checkout table on circ/circulation.pl 4. Notice that there is now 'Renew selected items' and 'Checkin selected items' button. 5. Play around with each making sure that they work as excepted when checkouts are checked in either the 'Check in' or 'Renew' columns. 6. Uncheck everything in the 'Renew column', the 'Renew selected items' button should be disabled. 7. Uncheck everything in the 'Checkin column', the 'Checkin selected items' button should be disabled. 8. Try unchecking some of these to make sure the Renew/Checkin button is properly disabled when no related checkboxes are checked. 9. Try using the select all/none options at the top of both the 'Renew' and 'Checkin' columns. Make sure the 'Renew selected items' and 'Checkin selected items' become properly disabled/enabled. 10. Make sure the 'Renew all' button still works properly. 11. Do the test plan of 5th patch "Make sure renew/checkin selections" Signed-off-by: Owen Leonard Signed-off-by: Kelly Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- .../prog/en/includes/checkouts-table.inc | 3 ++- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 25 +++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc index 05c888f055..a51fb10347 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc @@ -62,7 +62,8 @@ [% END %] - + + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index b434b504cd..1c8003b24a 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -30,11 +30,13 @@ $(document).ready(function() { $("#CheckAllRenewals").on("click",function(){ $("#UncheckAllCheckins").click(); $(".renew:visible").prop("checked", true); + $('#RenewChecked').prop('disabled', !$('.renew:checked').length ); showHideOnHoldRenewal(); return false; }); $("#UncheckAllRenewals").on("click",function(){ $(".renew:visible").prop("checked", false); + $('#RenewChecked').prop('disabled', !$('.renew:checked').length ); showHideOnHoldRenewal(); return false; }); @@ -42,10 +44,12 @@ $(document).ready(function() { $("#CheckAllCheckins").on("click",function(){ $("#UncheckAllRenewals").click(); $(".checkin:visible").prop("checked", true); + $('#CheckinChecked').prop('disabled', !$('.checkin:checked').length ); return false; }); $("#UncheckAllCheckins").on("click",function(){ $(".checkin:visible").prop("checked", false); + $('#CheckinChecked').prop('disabled', !$('.checkin:checked').length ); return false; }); @@ -64,11 +68,15 @@ $(document).ready(function() { if ( $(this).is(":checked") ) { $( "#checkin_" + $(this).val() ).prop("checked", false); } + $('#CheckinChecked').prop('disabled', !$('.checkin:checked').length ); + $('#RenewChecked').prop('disabled', !$('.renew:checked').length ); }); $(document).on("change", '.checkin', function(){ if ( $(this).is(":checked") ) { $( "#renew_" + $(this).val() ).prop("checked", false); } + $('#CheckinChecked').prop('disabled', !$('.checkin:checked').length ); + $('#RenewChecked').prop('disabled', !$('.renew:checked').length ); }); // Display on hold due dates input when an on hold item is @@ -97,7 +105,7 @@ $(document).ready(function() { }); // Handle renewals and returns - $("#RenewCheckinChecked").on("click",function(){ + $("#CheckinChecked").on("click",function(){ let refresh_table = true; $(".checkin:checked:visible").each(function() { @@ -138,7 +146,20 @@ $(document).ready(function() { async: false, }); }); + // Refocus on barcode field if it exists + if ( $("#barcode").length ) { + $("#barcode").focus(); + } + + if ( refresh_table ) { + RefreshIssuesTable(); + } + // Prevent form submit + return false; + }); + $("#RenewChecked").on("click",function(){ + let refresh_table = true; $(".confirm:checked:visible").each(function() { itemnumber = $(this).val(); id = "#checkin_" + itemnumber; @@ -237,7 +258,7 @@ $(document).ready(function() { $("#CheckAllRenewals").click(); $("#UncheckAllCheckins").click(); showHideOnHoldRenewal(); - $("#RenewCheckinChecked").click(); + $("#RenewChecked").click(); // Prevent form submit return false; -- 2.39.5