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 <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 7d80a1df25)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit e27ae1d138)
Signed-off-by: Jacob O'Mara <jacob.omara@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2023-07-27 15:01:24 +02:00 committed by Jacob O'Mara
parent 8f04bc45b4
commit f646329ee4

View file

@ -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);