From 55bf27c44fbf18046b4336d3fc1b0a533f4817c4 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 27 Jul 2023 15:01:24 +0200 Subject: [PATCH] Bug 34302: (bug 28653 follow-up) Do not refresh the table if an error happened If checkin or renew failed, we should not refresh the table or it will hide the error message. Test plan: Apply the DO NOT PUSH patch Do a renew => No error in the table Apply this patch Do a renew => You see the error Revert the DO NOT PUSH patch Do a renew => The table is refreshed Signed-off-by: David Cook Signed-off-by: Katrin Fischer --- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index 5e9156fcfd..e750767310 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -98,6 +98,8 @@ $(document).ready(function() { // Handle renewals and returns $("#RenewCheckinChecked").on("click",function(){ + + let refresh_table = true; $(".checkin:checked:visible").each(function() { itemnumber = $(this).val(); @@ -127,6 +129,7 @@ $(document).ready(function() { } else { content = __("Unable to check in"); $(id).parent().parent().addClass('warn'); + refresh_table = false; } $(id).replaceWith( content ); @@ -205,6 +208,7 @@ $(document).ready(function() { } else { content += __("reason unknown"); } + refresh_table = false; } $(id).replaceWith( content ); @@ -219,6 +223,10 @@ $(document).ready(function() { $("#barcode").focus(); } + if ( refresh_table ) { + RefreshIssuesTable(); + } + // Prevent form submit return false; }); @@ -250,10 +258,6 @@ $(document).ready(function() { return false; }); - $('#RenewCheckinChecked').on('click', function(){ - RefreshIssuesTable(); - }); - if ( Cookies.get("issues-table-load-immediately-" + script) == "true" ) { if ( LoadCheckoutsTableDelay ) { loadIssuesTableDelayTimeoutId = setTimeout( function(){ LoadIssuesTable() }, LoadCheckoutsTableDelay * 1000); -- 2.30.2