Bug 26208: Perform batch checkin/renewals serially rather than asynchronously

The issue here seems to be that when multiple requests hit at once they may not register that the renewal
performed by the request should lift restrictions on the account.

To mitigate this we can simply perform the renewals one after the other.

To test:
1 - have multiple overdue items on one patron
2 - run overdues.pl with triggers set to generate a restriction
3 - renew all overdues with the Renew All button
4 - restriction is not removed even though patron no longer has overdue items
5 - Apply patch
6 - Make all items overdue again
7 - Click Renew All
8 - Items are renewed and restriction removed
9 - Checkout items to patron again (overdue or not)
10 - Click 'Select all' in checkin column
11 - Click 'Renew/Checkin selected items'
12 - Confirm checkin succeeds as before patches

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Bug 26208: (follow-up) Remove debugging statements

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a825c72938)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Nick Clemens 2020-12-03 19:13:15 +00:00 committed by Fridolin Somers
parent e1f35cf347
commit b150fdc792
1 changed files with 53 additions and 41 deletions

View File

@ -110,24 +110,30 @@ $(document).ready(function() {
exempt_fine: $("#exemptfine").is(':checked')
};
$.post( "/cgi-bin/koha/svc/checkin", params, function( data ) {
id = "#checkin_" + data.itemnumber;
$.post({
url: "/cgi-bin/koha/svc/checkin",
data: params,
success: function( data ) {
id = "#checkin_" + data.itemnumber;
content = "";
if ( data.returned ) {
content = __("Checked in");
$(id).parent().parent().addClass('ok');
$('#date_due_' + data.itemnumber).html( __("Checked in") );
if ( data.patronnote != null ) {
$('.patron_note_' + data.itemnumber).html( __("Patron note") + ": " + data.patronnote);
content = "";
if ( data.returned ) {
content = __("Checked in");
$(id).parent().parent().addClass('ok');
$('#date_due_' + data.itemnumber).html( __("Checked in") );
if ( data.patronnote != null ) {
$('.patron_note_' + data.itemnumber).html( __("Patron note") + ": " + data.patronnote);
}
} else {
content = __("Unable to check in");
$(id).parent().parent().addClass('warn');
}
} else {
content = __("Unable to check in");
$(id).parent().parent().addClass('warn');
}
$(id).replaceWith( content );
}, "json")
$(id).replaceWith( content );
},
dataType: "json",
async: false,
});
});
$(".confirm:checked:visible").each(function() {
@ -170,36 +176,42 @@ $(document).ready(function() {
params.date_due = dueDate
}
$.post( "/cgi-bin/koha/svc/renew", params, function( data ) {
var id = "#renew_" + data.itemnumber;
$.post({
url: "/cgi-bin/koha/svc/renew",
data: params,
success: function( data ) {
var id = "#renew_" + data.itemnumber;
var content = "";
if ( data.renew_okay ) {
content = __("Renewed, due:") + " " + data.date_due;
$('#date_due_' + data.itemnumber).replaceWith( data.date_due );
} else {
content = __("Renew failed:") + " ";
if ( data.error == "no_checkout" ) {
content += __("not checked out");
} else if ( data.error == "too_many" ) {
content += __("too many renewals");
} else if ( data.error == "too_unseen" ) {
content += __("too many consecutive renewals without being seen by the library");
} else if ( data.error == "on_reserve" ) {
content += __("on hold");
} else if ( data.error == "restriction" ) {
content += __("Not allowed: patron restricted");
} else if ( data.error == "overdue" ) {
content += __("Not allowed: overdue");
} else if ( data.error ) {
content += data.error;
var content = "";
if ( data.renew_okay ) {
content = __("Renewed, due:") + " " + data.date_due;
$('#date_due_' + data.itemnumber).replaceWith( data.date_due );
} else {
content += __("reason unknown");
content = __("Renew failed:") + " ";
if ( data.error == "no_checkout" ) {
content += __("not checked out");
} else if ( data.error == "too_many" ) {
content += __("too many renewals");
} else if ( data.error == "too_unseen" ) {
content += __("too many consecutive renewals without being seen by the library");
} else if ( data.error == "on_reserve" ) {
content += __("on hold");
} else if ( data.error == "restriction" ) {
content += __("Not allowed: patron restricted");
} else if ( data.error == "overdue" ) {
content += __("Not allowed: overdue");
} else if ( data.error ) {
content += data.error;
} else {
content += __("reason unknown");
}
}
}
$(id).replaceWith( content );
}, "json")
$(id).replaceWith( content );
},
dataType: "json",
async: false,
});
});
// Refocus on barcode field if it exists