From f646329ee4a7d244fd4ae179e592360e3024efab 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 Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 7d80a1df25a1c4e726bcf148e1c2432ea8c9a007) Signed-off-by: Fridolin Somers (cherry picked from commit e27ae1d138e3cfa268feb5fc4be05059181f47e4) Signed-off-by: Jacob O'Mara --- 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 4947116f0d..7c586adeed 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -96,6 +96,8 @@ $(document).ready(function() { // Handle renewals and returns $("#RenewCheckinChecked").on("click",function(){ + + let refresh_table = true; $(".checkin:checked:visible").each(function() { itemnumber = $(this).val(); @@ -125,6 +127,7 @@ $(document).ready(function() { } else { content = __("Unable to check in"); $(id).parent().parent().addClass('warn'); + refresh_table = false; } $(id).replaceWith( content ); @@ -203,6 +206,7 @@ $(document).ready(function() { } else { content += __("reason unknown"); } + refresh_table = false; } $(id).replaceWith( content ); @@ -217,6 +221,10 @@ $(document).ready(function() { $("#barcode").focus(); } + if ( refresh_table ) { + RefreshIssuesTable(); + } + // Prevent form submit return false; }); @@ -247,10 +255,6 @@ $(document).ready(function() { return false; }); - $('#RenewCheckinChecked').on('click', function(){ - RefreshIssuesTable(); - }); - if ( Cookies.get("issues-table-load-immediately-" + script) == "true" ) { LoadIssuesTable(); $('#issues-table-load-immediately').prop('checked', true); -- 2.20.1